cancel
Showing results for 
Search instead for 
Did you mean: 

leading and lagging spaces in Information steward

0 Kudos

I have a requirement to detect leading spaces and lagging spaces from any field can you please suggest IS rule syntax to be used

for example i want to be able to detect the following scenarios

1) (SPACE) ABC

2) ABD(SPACE)

appreciating your help

Laith

Accepted Solutions (1)

Accepted Solutions (1)

NielsWeigel
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Laith,

The response to your question last year (detecting leading spaces in information steward | SAP Community) was more on how to remove the spaces before applying a rule.

I expect you want to create a rule where all records that do NOT have leading or trailing spaces will pass the rule and all the others will be failing.

My suggestion would be to have in the rule expression then the comparison of strlen($input)=strlen(ltrim($input) and if this returns a FALSE, then there must be some Spaces in your $input variable. Same for rtrim.

If you do not want to separate with 2 rules between the leading or trailing spaces you could combine the ltrim(rtrim($input)).

I didn't verify and test the rule within an IS system, but it should be an idea on how to solve the requirement.

Niels

0 Kudos

many thanks for your reply i used the following syntax and it seems it is working

BEGIN

IF ($Field1=ltrim($Field1)) RETURN TRUE;

ELSE RETURN FALSE;

END

i will test it now with right trim

Answers (0)