Hi everyone,
I am testing out a form and one of the functionalities I want is that when the user presses a button only the last part of the string will get passed through to the MEL_UPDATED_FHX data symbol and it will ignore the first 19 characters)
I am having issues when changing the starting position. When using the example below for last name SMITH I get "smith"
{USEROK((sub(PATIENT.LASTNAME,1,size(PATIENT.LASTNAME))))}
however I was trying something such as:
{USEROK((sub(PATIENT.LASTNAME,3,size(PATIENT.LASTNAME))))}
where I was hoping to just get "ith". However when I change the starting position i get a mel parse error
So basically I want to only send part of the string to the MEL_UPDATE_FHX and I am having trouble getting that starting position to be in the middle of the original string.
Any ideas?
Thanks
Dave Montgomery
The thirs argument is the length, not the end point, so you need to subtract two from your example. Sub is trying to start at 3, and go 5 characters to the right, which gets to 7 which obviously doesn't exist, smith is only 5 letters. So try
{USEROK(sub(PATIENT.LASTNAME,3,size(PATIENT.LASTNAME) - 2))}
Just a wild thought..
sub("smith",1,5) => "smith"
sub("smith",3,5) => ERROR; could this because the length is too long? Perhaps
sub("smith",3,3) =>? "ith"
gibsonmi said:
The thirs argument is the length, not the end point, so you need to subtract two from your example. Sub is trying to start at 3, and go 5 characters to the right, which gets to 7 which obviously doesn't exist, smith is only 5 letters. So try
{USEROK(sub(PATIENT.LASTNAME,3,size(PATIENT.LASTNAME) - 2))}
This worked perfectly. Thanks for explaining it. Sometimes the GE help can be confusing.
Dave