So I wrote the following expression:
Could someone tell me what I have to write correctly to detect if the field "Prénom" does contain a specific character different of alphabetic charac, '-' and spaces ?
Thanks so much for your help,
Thanhng34
Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Could someone tell me what I have to write correctly to detect if the field "Prénom" does contain a specific character different of alphabetic charac, '-' and spaces ?
Thanks so much for your help,
Thanhng34
Your expression should correctly purge spaces at the start, middle or end of the string. Perhaps they are not simple ASCII spaces (chr(32)), they are instead, for example, a no-break space (chr(160)). Try this:
If(len(PurgeChar(Upper([Prénom]), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ- ' & chr(160))) > 0, 1, 0) as FlagErrorFN
Some databases pad out CHAR() fields with no-breaks, and Excel uses them for thousand spacing, among others.
why not remove the space with trim() before purge
If(len(PurgeChar(trim(upper([Prénom])),'ABCDEFGHIJKLMNOPQRSTUVWXYZ-'))>0,1,0) as FlagErrorFN
Hi Taoufiq,
Thanks so much for your help. But it did not work because there are double names with spaces between two words (For example, Jean Claude). The “trim” function can just remove spaces before and after the string, not between words. So those double names were detected as containing special characters ☹
Best regards;
Hi
Try this
IF(WildMatch(trim('prenom'),'*-*',' ')>0,1,0)
Hope this helps
Thanks
Your expression should correctly purge spaces at the start, middle or end of the string. Perhaps they are not simple ASCII spaces (chr(32)), they are instead, for example, a no-break space (chr(160)). Try this:
If(len(PurgeChar(Upper([Prénom]), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ- ' & chr(160))) > 0, 1, 0) as FlagErrorFN
Some databases pad out CHAR() fields with no-breaks, and Excel uses them for thousand spacing, among others.
Hi @jonathandienst ,
Your expression works well in my case. Thanks so much for your help ^^
Could you explain to me what is the difference between chr(32) and chr(160) ?
Chr(32) is a normal ASCII space character (what you get when you hit the space bar).
Chr(160) is the unicode entity (non-break space), which is used in word processors and spreadsheets to prevent a line breaking or wrapping on this space. For example, if you use spaces as a 1000s separator, you don't want the number printed across 2 lines.