I am trying to include the following expression in a field's (equation type) description but doesn't work properly. I want this field to automatically get the value of another field (numeric or not) plus another text e.g. if(A5 == 'A1', A5 and 'text," ''). I want to have the value of a field (A5) followed by text (text). If I put only one of them works e.g. A5 or text but concatenated not.
What is the correct syntax?
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. -
Professional support
-
Plugins, theme and development
. I don't answer to private message.
Thank you for your reply. It worked with the following code ({if(A5=='A1','P' + DateFieldA,'')})but I have another issue.
One of the fields that I am using for the concatenation is date/time (DateFieldA) where I don't need/use the time and the format of the field is "dd-mm-yyyy". On the selection of the field the value is displayed correctly e.g. 27/03/2017 but when I use it to the other field as part of the concatenation the format that is being displayed on the result is as follows: "2017-03-09 00:00" How can it be displayed exactly as it is on the original field and with no time e.g. "dd-mm-yyyy"? Can I use format on the concatenation?
You can use the expression manager to remove hh:mm. I am sure there are several ways to do this but here's one way: {date("d/m/Y", stftotime(my_date_question))}
So in your case it would be something like: ({if(A5=='A1','P' + date("d/m/Y", strtotime(DateFieldA)),'')})