Know the uppermost letter

Hello everyone,

I need you. I’m capturing a substring like that :


This is all the possibilities : A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z.

I capture several letter like this, and i want to know what’s the letter which is the uppermost where A < B < C < D < E < F…

Thanks a lot.

To know whether its a upper case or not
this expression in IF condition would help you

Cheers @BaptisteC

Hi @Palaniyappan,

Thank for your reply. I don’t want to know if the letter is uppercase but i want to know the letter the most superior.

1 Like

can i have an example if possible
Cheers @BaptisteC

check for putting all Letters in an array or list and using index information for the uppermost calculation

Of course.

M2 B7 41087A4000AD030
M2 B7 41087A4000AL310
M2 B7 41087B4000AL320
M2 B7 41087B4000AL330

The 4 lines is 4 transactions data. I’m capturing the bold letter which are the transaction version. I want to know which letter is the upper where :
A = 1
B = 2
C = 3
D = 4
… etc

if i have an A and B version i keep B, if have an A, B and C i keep C, etc…

Thank you.

Hi @ppr,

How can i create an array with all the letter ?

Like that :

new List(of String) ?
But where i have to put my list after ?

And how can i create an index for each letter ?

just wait your sample data gave some new insights.
can you give more details e.g on provided datastructures and are there multiple sets to take into account?

i’m working on a data table with 3 columns. I use a substring to recover the version like that :

For each on DT

I have a condition after :

If row(“Column3”).ToString.Substring("0,5) = Num_Transaction

In my example above (Num_Transaction = 41087)

Log message : row(“Column3”).ToString.Substring(6,1) => To verify if my if works

1 Like

we can use the same expression like this
because the ascii value of A, B, C, D…will be like 65, 66, 67, 68… so with that value we can compare which one is the highest and get that value from the transaction

Cheers @BaptisteC


I don’t understand…

I think that i can do like that :

Assign : ValueBefore = DT.Rows(Index -1).Item(“Column3”).ToString

If : row(“Column3”).ToString.Substring(5,1) > ValueBefore.ToString.Substring(5,1)


I don’t know what i can put in “Then” to keep the letter

Have a look on this sample and feel free to adopt as per your needs. Let us know your feedback on this
BaptisteC.xaml (8.9 KB)

1 Like

Hey @ppr,

For understand all your sample. Can you explain me what you’ve done with your differents assign activity ?

Thank you so much !

Your sample is over my skills :rofl:

i try to adapt your sample with my needs but doesn’t work.

My real text file is this : TMTC.txt (1.7 KB)

When i use your sample, others rows come on my output…

I will have soon a Look on IT. Can you provide ne your xaml so i can See in how you readin the Data from Text into Datatable

can you please comfirm following:
run my xaml as it is, result would be the C Row, does it do the same at your end

Your data provided in the txt is varying in the dataformat structure:
F0 B7 1000 140819FRT3ORDLIV
M2 B7 41087A2000 0 00288000010F00304805D17081923081920081920140819O
M2 B7 41087A4000AD030 4028800001

M2 B7 41087A4000TM000 HIGH
M2 B7 41087A3001 0 00354874A500000010000000007720
F0 B7 1000 140819FRT3ORDLIV

If I would assume that 3rd column is to check then values like the first an last row would not match the expected format (e.g. less characters, no letter)

Additional what would be the expected result from your data? the most values (3rd Col) are in the form 41087A3001, there are no so called B values, how to decide whic A row is that one to retrieve

Let me know your answer, Thanks

dtSample.AsEnumerable.Select(function ( r ) r(“Column3”).ToString.Substring(0,5)).Distinct().toArray
from 3rd col the substring 0,5 is used, removed the duplicate groups values and store it into an array

transfers the schemainformation dtSample to the other datatable forseen to hold the result data

Within the loop over the groups from above it is calculating the mostupper Letter of all rows belonging to the group:
dtSample.AsEnumerable.Where(Function (row) row(“Column3”).ToString.Substring(0,5).Equals(item)).OrderByDescending(Function (row) row(“Column3”).ToString.Substring(5,1)).First()

where: filtering the group
orderByDecending: Ordering on the Letter (Z-A)
First: taking the first row from result (Thisone with the mostupper letter so C before A …)

your letters can be converted to numbers like this Convert.ToInt32("A"c), then you can do your code to know the uppermost…