Loop and merge - Using a l&m field based on criteria | XM Community
Solved

Loop and merge - Using a l&m field based on criteria


We are collected addresses of places where respondents lived via a loop and merge. I have collapsed the addresses into one embedded field by loop number. Now, we'd like to answer a series of questions on each property. BUT, if they didn't give an address, we want to insert a generic term:

So field 2 contains TotAdd1 (from embedded field)
Field4 contains "current address" or "2nd address you provided" or "3rd address you provided"

My new loop questions read (as an example):

1. Tell us how long you have lived at (Insert Field here).

If they didn't know the address, and for now, it's blank, I want to use Field4. If they did provide an address, I want to use Field2.

Can this be done and if so, how? thank you!
icon

Best answer by TomG 30 May 2019, 17:29

View original

2 replies

Userlevel 7
Badge +27
Pipe both with Field4 inside a `<span>` tag, then use JS to hide Field4 if you don't need it.

html:
```
${lm://Field/2}<span class="field4">${lm://Field/4}</span>
```

js:
```
if("${lm://Field/2}".length > 0) jQuery(".field4").hide();
```
thank you so much! Worked perfectly......

Leave a Reply