Creating an address block from different fields
I have a shipping table with different fields for address components (line 1-4, city, state, post code)
I can create a block showing the address without the if formulas, but if say line 3 and 4 are empty they show us line breaks, which I don't want, which is why I'm attempting this with an if then, but I feel like its not the way to go.
Current code:
let line1 := 'Shipping Address'.'Address Line 1';
let line2 := 'Shipping Address'.'Address Line 2';
let line3 := 'Shipping Address'.'Address Line 3';
let line4 := 'Shipping Address'.'Address Line 4';
let city := 'Shipping Address'.City;
let state := 'Shipping Address'.State;
let pc := 'Shipping Address'.'Post Code';
if line1 != null then
line1 + "
" and if line2 != null then
line2 + "
" and if line3 != null then
line3 + "
" and if line4 != null then
line4 + "
" and city + " " + state + "
" + pc
end
end
end
end
11 replies
-
Given..
Here is the code for Address Label
-
Fantastic formula! Thank you! Very userful!!
-
i need fonts to be Bold. is it possible?
-
i found bold thank you
-
I forgot to thank you back then Mconneen - works a treat, tah!
-
@Sarah... No worries.. that is what the forum is for. There are also several Ninox Solution Partners that offer FREE YouTube channel (Ninox Learning) as well as pay as you go one on one training.
-
Mconneen
Thanks for this. It was exactly what I was looking for.
One question. What is the purpose of the "t" vairiable a "this" comand?
I tried it without and it works exactly the same.
-
And another proposed solution:
let c := join([City, State, 'Post Code'][!= ""], " "); join(['Address Line 1', 'Address Line 2', 'Address Line 3', 'Address Line 4', c][!= ""], " ")
-
Thanks all for the help.
I ended up with this code which formats the postal address filed depending on the country selects on the combo box "country".
Easy to add more countrys and address formats as needed.
let xAdUS := ( let s := ""; let a := ['Address 1', 'Address 2', 'Address 3', 'Address 4']; let p := ""; for i in range(0, 4) do p := item(a, i); if length(p) > 0 then s := s + p + " " end end; s + City + " " + State + " " + 'Post Code' + " " + Country ); let xAdUK := ( let s := ""; let a := ['Address 1', 'Address 2', 'Address 3', 'Address 4']; let p := ""; for i in range(0, 4) do p := item(a, i); if length(p) > 0 then s := s + p + " " end end; s + City + " " + 'Post Code' + " " + Country ); let xAdFrance := ( let s := ""; let a := ['Address 1', 'Address 2', 'Address 3', 'Address 4']; let p := ""; for i in range(0, 4) do p := item(a, i); if length(p) > 0 then s := s + p + " " end end; s + 'Post Code' + " " + City + " " + Country ); let xAdHK := ( let s := ""; let a := ['Address 1', 'Address 2', 'Address 3', 'Address 4']; let p := ""; for i in range(0, 4) do p := item(a, i); if length(p) > 0 then s := s + p + " " end end; s + City + " " + Country ); switch text(Country) do case "AUSTRALIA": xAdUS case "USA": xAdUS case "UNITED KINGDOM": xAdUK case "CANADA": xAdUS case "FRANCE": xAdFrance case "GERMANY": xAdFrance case "HONG KONG": xAdHK default: xAdUS end
Content aside
-
1
Likes
- 2 yrs agoLast active
- 11Replies
- 2275Views
-
4
Following