Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

STR_PAD_LEFT

  • Archaeos
  • Archaeos's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 11 months ago #135028 by Archaeos
STR_PAD_LEFT was created by Archaeos
Does limesurvey support STR_PAD_LEFT? I am using: str_pad(storeNum, 5, '0', STR_PAD_LEFT) but LS wont recognize pad left. It gives me a "undefined variable" error.

Thanks.
The topic has been locked.
More
7 years 11 months ago #135045 by first
Replied by first on topic STR_PAD_LEFT
here is the list of support EM functions. Is this something you are looking for?

Survey Designer and Programmer
The topic has been locked.
  • Archaeos
  • Archaeos's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 11 months ago #135077 by Archaeos
Replied by Archaeos on topic STR_PAD_LEFT
I dont think so. I was working off of this in an equation field. Basically I have a place where someone enters their store number which can be at max 5 numbers. But all store numbers have leading 0. So if someone enters in store 20, their real store number is 00020. To make sure that the store number shows correctly even when people dont enter the leading zero I made the above code in a hidden equation field. So LS has support for str_pad and it works using just str_pad, it just pads with zeros the wrong way (default is right) but I need it to pad left.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 11 months ago #135110 by DenisChenu
Replied by DenisChenu on topic STR_PAD_LEFT
I think EM don't have the fourth parameter.

Then need another system

Something like this maybe:
Code:
{join(if(strlen(QQ)<1,"0",""),if(strlen(QQ)<2,"0",""),if(strlen(QQ)<3,"0",""),if(strlen(QQ)<4,"0",""),if(strlen(QQ)<5,"0",""),QQ)}

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • Archaeos
  • Archaeos's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 11 months ago #135154 by Archaeos
Replied by Archaeos on topic STR_PAD_LEFT
Thanks, that works out great.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose