Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I want to split a string and need to take first letter of substring to make a new field
e.g: ABC TECH LTD as ATL
How can i acheive this?
Regards,
Sivaraj
Probably not, but you can track the Text line and the subfield order like this:
TEXTS:
Load
recno() as TextID,
rowno() as PartID,
left(subfield(F1,' '),1) as Parts;
Load * inline [
F1
ABC TECH LTD
Hello world
Beta Alpha
];
Load
TextID,
concat(Parts,'',PartID) as Done
resident TEXTS group by TextID;
this is one string (one field)
or
three fields?
You Can try something like this.. considering this is a single field value..
Left(SubField(Name, ' ', 1), 1) = This will get you the result A
Left(SubField(Name, ' ', 2), 1) = This will get you the result T
Left(SubField(Name, ' ', 3), 1) = This will get you the result L
Left(SubField(Name, ' ', 1), 1) & Left(SubField(Name, ' ', 2), 1) & Left(SubField(Name, ' ', 3), 1) = This will give you ATL
hope that helps..
This example script should help you out:
Load
concat(Parts) as Done;
Load
left(subfield(F1,' '),1) as Parts;
Load * inline [
F1
ABC TECH LTD
];
Hi,
Another option, not very orthodox but useful in case the field has not fixed number of elements (not always 3) would be the following:
=Concat(Left(SubField('ABC TECH LTD', ' ', ValueLoop(1, SubStringCount('ABC TECH LTD', ' ') +1, 1)), 1), '', ValueLoop(1, SubStringCount('ABC TECH LTD', ' ') +1, 1))
Hope that helps.
Miguel
Johannes example concatenates the Parts in random order,
and if there is more than one record in the inline table,
the initials from the different records get mixed.
So:
Load
concat(Parts) as Done;
Load
left(subfield(F1,' '),1) as Parts;
Load * inline [
F1
ABC TECH LTD
Hello world
];
gives me a Done: AHLTw
I don't think that's what you want.
Probably not, but you can track the Text line and the subfield order like this:
TEXTS:
Load
recno() as TextID,
rowno() as PartID,
left(subfield(F1,' '),1) as Parts;
Load * inline [
F1
ABC TECH LTD
Hello world
Beta Alpha
];
Load
TextID,
concat(Parts,'',PartID) as Done
resident TEXTS group by TextID;
Hi Miguel,
Thanks that is working fine but valueloop throwing error in script
How can i acheive the same in script
Regards
sivaraj
Hi,
Did you find any solution to this? Im trying to use this for my excel Fields.. Any help?
@swuehl , good Work. Forgive me for my incapability to understand your solution. I have few doubts
1) I tried to load Inline data 1st and then TEXTs Table and then resident table, why it is throwing error?
2) Why F1 field not coming into dashboard?
3) How to remove ' of ' if I have data like this ' International Inst of Tech'