Dynamic assign

Hi Guys,

I have a question regarding the possibillity of a dynamic variable. The thing is, i would like to extract data from an excel file (via a for each). The data differs per row, but i always need the value up till the “H” in the cells. For example, one row the data is 012345678H3221 and the next cell the data is 01234H3221. Ideally, i would like to use an assign function so that it always extracts the numbers before the “H”. does anyone have any ideas?

KR,

Matthew

Assign String2 = left(String1, String1.indexof(“H”))

Or

String2 = String1.substring(0, String1.indexof(“H”))

Hello,

Please use below xaml file to extract only number before any character.

Main.xaml (10.7 KB)

Cheers,
Pankaj

Hello @Matthewvz

See attached possible solution

getNumbersBeforeH.xaml (9.6 KB)

Hope it Helps! :slight_smile:

Thanks this works. What if i for example want to extract the values right of the H? If i just use string 2= right(string1,string1.indexof(“H”)) it does not work. (these values also change, sometimes the integer length is 4 other times it is 6 etc).

You can use LastIndexOf

string 2= right(string1,string1.LastIndexOf(“H”))

hmm this does not seem to work. it also provides the 4 digits before the H (including the H itself) as a value

string2 = string1.Substring(string1.indexof(“H”)+1)

THanks!!! it works :slight_smile:

Much appreciated

1 Like

Great!

[Please mark appropriate answer and solution and close thread]