Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
In one of my fields, I have data like ' XXXX YYY ZZ' and I want them as 'XXXX YYY ZZ'
How can I do that?
This is an example of Rob Wunderlich's technique, check CLEANED_TEXT after cleaning from spaces.
SpaceMap:
MAPPING LOAD repeat(' ', RecNo()), ' '
AutoGenerate 10 // up to 10 spaces
;
SAMPLE:
LOAD * Inline
[TEXT
HELLO AND WELCOME
THIS IS A SAMPLE TEST
I AM NOT SURE
];
DATA2:
LOAD MapSubString('SpaceMap', trim(TEXT)) as CLEANED_TEXT
Resident SAMPLE;
I hope this helps!
MultiView
While loading your data in script editor, You can use ltrim() function to remove leading spaces.
example:
from xyz.......
similary rtrim() to remove spaces from the end.
Below will remove leading and trail spaces from column name Relation and alias name of that column will be rel
ltrim(rtrim(Relation)) as rel
LOAD
ltrim(Relation) as rel
While loading your data in script editor, You can use ltrim() function to remove leading spaces.
example:
LOAD
ltrim(Relation) as rel
from xyz.......
similary rtrim() to remove spaces from the end.
Below will remove leading and trail spaces from column name Relation and alias name of that column will be rel
ltrim(rtrim(Relation)) as rel
If the trend is constant then we can do it.
let the field be Name
expression can be like this
=Subfield(Name,' ')
may it work
This might helps you
Replace(LTrim(' XXXX YYY ZZ'),' ',' ')
One solution would be to use a MAPPING TABLE wih MapSubstring().
SpaceMap:
MAPPING LOAD repeat(' ', RecNo()), ' '
AutoGenerate 10 // up to 10 spaces
;
And in your LOAD statement:
MapSubString('SpaceMap', trim(x)) as y
-Rob
That's an excellent solution!
Regards
MultiView
Rob ,
will you please explain how it works
?
Hi Rob,
Please can you send a example in qvw?
Thanks,
Hi,
You have the example in qvw?