Field Calculation works on Connect but not on web

939
4
Jump to solution
07-20-2021 11:09 AM
RuchiraWelikala2
New Contributor III

Hi All,

I have a form that uses a condition based on one of the "select_one" fields in my survey. 

This is the condition I'm using in the "calculation" field. 

if(selected(${applicant_name},'Bell_Canada'),'BC-' + format-date(${_date},'%y') + '-CA-','None')

 

Basically, if "Bell Canada" is selected, the field calculate will insert "BC-21-CA" into the "application_number". 

This works well in Survey123 Connect, however, when I try it in the browser, the field shows "NaN". 

Not sure why this is and any info to rectify this issue would be much appreciated.

Thank you,
Ruchira

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
DougBrowning
MVP Esteemed Contributor

I wonder if you need to use concat() instead of + for the web?  I may remember seeing that.

View solution in original post

4 Replies
DougBrowning
MVP Esteemed Contributor

I wonder if you need to use concat() instead of + for the web?  I may remember seeing that.

RuchiraWelikala2
New Contributor III

Thanks, Doug! That worked. Like you said, concat works on both the web and connect. 

RyanBohan
Occasional Contributor III

I had this issue we well. In connect and the preview screen. You can add together strings with the + sign.  On a web browser this breaks and you get Nan as an error.  

(${selected_cd1} + ',')   works fine in connect, does not work in a browser

concat(${selected_cd1},',') , '')  the work around is to use concat, works both in connect preview and the browser

 

0 Kudos
RuchiraWelikala2
New Contributor III

Yeah, quite odd. I'm glad the concat work around exist though. Really saved my behind!