與我的第一個問題類似。我想告訴我的地址在包含字段的文本框,如下所示當某些字段爲空時,公式將不會顯示
{Company}
{AddLine1}
{AddLine2}
{ZIP}{State}{City}
{Country}
與我相關的線(希望你們中的一些人)是{ZIP} {城市} {}國。我想生成的是一致的尋址格式,即使ZIP,城市或州字段在數據庫中留空,也不會有空白區域或縮進。這行應該仍然與其餘的行對齊,而不是縮進。我也希望在zip,state,city之間插入逗號,並將它們留在不相關的地方。爲此我寫了一個公式。下面:
If isnull({BILL_TO.ZIP}) or trim({BILL_TO.ZIP})= "" Then "" else {BILL_TO.ZIP}
+
(If isnull({BILL_TO.State}) or trim({BILL_TO.State})= "" Then ""
else(If not isnull({BILL_TO.ZIP}) and length(trim({BILL_TO.ZIP})) <> 0 Then ", " else "") + {BILL_TO.State})
+
(If isnull({BILL_TO.CITY}) or length(trim({BILL_TO.CITY})) = 0 Then ""
else(
If (not isnull({BILL_TO.State}) and length(trim({BILL_TO.State})) <> 0)
or
(not isnull({BILL_TO.Zip}) and length(trim({BILL_TO.Zip})) <> 0)
Then ", " else "")+ {BILL_TO.CITY}))
問題是,當只有一個城市(沒有州或拉鍊輸入)公式本身不會顯示。但是,當其他人出席時,它會顯示。
任何人都可以在此代碼中看到一個錯誤?它殺了我
感謝您的幫助。
期待您的迴音!
這並沒有解決在ZIP,City和State之間有條件地添加空格和逗號的問題。 – Ryan