Hi,
I am in a report and i am trying to write some code in the "source expression" field. what I am attempting to do is to show the last 4 characters of the given field, however when i have a field that does not have any characters it gives me a "less then 0" error.
This is the function that i have come up with:
COPYSTR(PayCheckBuffer[RightSide]."Payroll Control Name",STRLEN(PayCheckBuffer[RightSide]."Payroll Control Name")-3,4)
so how do i write this script so that it only returns the last four characters if there is a value in the field?
thanks a ton,
chris
0
Comments
2)Is It normal to be blank?
3) Make a Variable varPayContolName
Do something like
IF (STRLEN("Payroll Account Name") > 3)
then
VarPayControlName := varPayControlName:= COPYSTR("Payroll Control Name",((STRLEN("Payroll Control Name"))-3),4)
Else
VarPayControlName := 'Oops'; //Whatever you want to do if it's blank
varPayControlName will then be the sourceExp Field.
http://www.BiloBeauty.com
http://www.autismspeaks.org
When you are selection from a point to the end of a string you do not need to specify the length.
so you can leave out the ,4 and the()
COPYSTR("Payroll Control Name",STRLEN("Payroll Control Name")-3)
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com