Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Experts,
I have a Script
if Len(Trim('$ (vStartDate)'))=0 then
Let vStartDate = Date(Today());
EndIf
Let vStartDate = Date('1/1/2021');
Can Anyone explain its working ?
Thanks in Advance
First if section checks if the variable has got any value or not, if not then today date would be assigned to the variable. And then again the variable value gets overwritten by '1/1/2021'. This is as good as having only the last line of your code, i.e. - if structure is redundant here. This could have a meaning if you had else section in the if structure.
Trim() in such cases used to avoid unwanted spaces, because if you don't have a date in variable and have a space your len() would still return value >0.
First if section checks if the variable has got any value or not, if not then today date would be assigned to the variable. And then again the variable value gets overwritten by '1/1/2021'. This is as good as having only the last line of your code, i.e. - if structure is redundant here. This could have a meaning if you had else section in the if structure.
Thank you @tresesco.
Can you explain use of trim function here
Trim() in such cases used to avoid unwanted spaces, because if you don't have a date in variable and have a space your len() would still return value >0.
Thankyou so much @tresesco