Loop and merge - Using a l&m field based on criteria | XM Community
Skip to main content
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!

Best answer by TomG

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(); ```
View original

2 replies

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5938 replies
  • Answer
  • May 30, 2019
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(); ```

  • Author
  • 8 replies
  • May 30, 2019
thank you so much! Worked perfectly......

Leave a Reply