How to get the String() Frist Value in Message Box

How to het the String() Frist Value in Message Box

String () value = {“111”,“222”,“333”,“444”}

Want a Value Like
111

value(0)

@krishnapriya_Anu

Value.First or value(0) will give it

Cheers

I pass the value in the variable

in the for each

List of Item = variant Names
item = currentitem

in the message

Cureentitem(0).Tostring()

It’s only PRINT the First letter

image

I Need first String Full value

Just print Cureentitem

But if you’re doing a loop it will return all items.

if you want just the first, avoid the loop and simply write Variant_Names(0). This will return the 1st item from the list Variant_Names.

@krishnapriya_Anu

If inside loop then directly use currentitem…

As the loop will iterate through all

Cheers

But I’m using the Nested IF

At the top level you are using a loop right?
You can directly access elements of an array without using loop, array(index number) start from zero.

If you are inside a loop and looping on array then no need of indexing directly access current item.

Thanks.

Hi @krishnapriya_Anu

I have attached the workflow for your reference. The workflow contains extraction of First value i.e 111 or running an for each loop and getting all the values in the array of String.

1.xaml (8.8 KB)

Hope it helps!!
Regards,

@krishnapriya_Anu

What are you using in if?

And whatever you use …first iteration of currentitem will be the first element

Cheers

String () value = {“111”,“222”,“333”,“444”}

If condition
String of value (111 = Get_text_Frist_Value)
else
String of value (222 = Get_text_second_Value)

@krishnapriya_Anu

Can you please tell what you are trying to acheive?

If you need to know the index of the items…then in for loop properties you already have it

Cheers

@krishnapriya_Anu

Rather than writing these many If conditions you can directly print the first value or iterate through loop to get all the values .

To directly get the first value

input(0) 
Output: 111

Run for each loop and print the value using currentItem.

Attached the workflow above for reference.
Hope it helps!!
Regards,

Actually I need the value of the Frist String of array

I want to Compare value’s of String of array first value and Get text Frist value if Both are same I click the Frist Button in sap

I want to Compare value’s of String of array Second value and Get text Second value if Both are same I click the Second Button in sap.

Like…

@krishnapriya_Anu

so you want to compare first with first only or any row?

if you want to compare the first with first ,second with second etc then use array(index) = gexttextvalue and here index is the value from the for loop and as the iteration changes index changes…and the same index can be used to iterate on sap row values as well

cheers