Our team wants to generate a concatenated address based on a user's input for street, city, state, and zip. The issue is many times a user may not fill out all four of these inputs. Is there a way to efficiently generate all combinations for the concatenated address field without writing 12 if statements?
For example, if a user has all 4 fields filled out, we want to return this:
return current.agency_street + ', ' + current.agency_city + ', ' + current.agency_state + ', ' + current.agency_zip;
If they have everything filled out except zip code, we want to return this:
return current.agency_street + ', ' + current.agency_city + ', ' + current.agency_state;
Is there a way to do this without all the if statements? Thanks!