Collate 3 Text Fields Into 1 Field

294
3
12-22-2018 05:57 PM
Highlighted
New Contributor II

I have three different text fields. I would like to collate the three text fields. Is this possible? I've managed to do this when collating 2 fields, but I have been unsuccessful when attempting to collate three fields. Only one of the three text fields will ever be completed. Below is an example of successful collation:

Type      Name                            Label                  Calculation

hidden   vesselnamecollated      Vessel Name     if(string-length(${newvesselname})>0, ${newvesselname}, ${vesselname})    

Any advice would be greatly appreciated.

Thank you!

Tags (1)
Reply
0 Kudos
3 Replies
Highlighted
Esri Frequent Contributor

Hi Sage,

Can you confirm what you mean by collate 3 text fields? Do you mean displaying one or the other or the other based on if they exist in a specific order? If so yes this is possible using nested if() statements.

Or do you need to concatenate them and display them all together in one field, separated by space or comma? If so yes this is also possible.

Please share your xlsx file with the fields you are trying to collate and provide better explanation and can take a more detailed look.

Phil.

Reply
0 Kudos
Highlighted
New Contributor II

Hi Philip,

Thanks for your response. I think I'm looking for nested if (statements). I have three text fields. They are notes for 3 different sections of the survey - vacantmooringnote, newvesselnote, and notes. Only one of the three fields will be filled-in per entry. I will never have 2 or more of these text fields filled-in. These three fields are null in the esri data type. Then I have created a hidden field where I would like any response that is completed in one of the three text fields in the survey to be reflected in this hidden field. I've managed to figure out how to do this when I have 2 fields, but I'm having trouble with the three fields. My excel spreadsheet is attached.

I hope this is more clear. Thank you in advance.

Reply
0 Kudos
Highlighted
Esri Frequent Contributor

Hi Sage,

For example, you can use the following nested if() statement to achieve what you are after:

if(string-length(${vacantmooringnote})>0, ${vacantmooringnote},
      if(string-length(${newvesselnote})>0, ${newvesselnote},
         ${notes})
   )

I have attached a simple example based on your xlsx form to demonstrate how it works. Note that the first answer that is true will always take priority over the other answers if all questions have answers. They are processed in order.

Phil.