Issue with workbook cell selection

Hey Guys,
Need your help.
As you can see in below picture, I want to create a simple workflow for below function.
1.Input dialogue, give a selection list contains all “Short Name” to user to select.
2.Get the Vendor code that has the same"Short Name "of selected value.
3.Display the Vendor code extracted above in a message box
I’m stuck in the steps of assign value, I have no idea what’s wrong with my words or types of values.
It’s much appreciated if you have more simple and efficient ways to achieve this.

vendor list.xlsx (9.5 KB)
Check price.xaml (10.4 KB)

Capture%20A

@Allen_Huang Please check the below workflow.

Check price.xaml (11.4 KB)

Hi Manjuts,
Thanks a lot! It really works and more efficient than my logic.
The key part is below, sorry I’m not familiar with the programming words, could you please explain me a bit more about this expression?
Select the workbook column “short name”=variable ShortNam to string, why there is a +""?
And what’s the purpose of “(0)(1).ToString”?

VendorList.Select("[Short Name]=’"+ShortNam.ToString+"’")(0)(1).ToString

1 Like

@Allen_Huang

For using variables we use “+variable+” format

when we use select statement we get array of datarows as output. From that array of datarows we want to select first row from output we used “(0)” and from that row we want value from second column, we used “(1)”. Usually values in datatable is stored as object datatype, so we have used “.ToString”.

Please let me know if you still have any doubt on it.

1 Like

Dear Manjuts,

Thanks again for your patience.
Now I almost understand the method.
Pardon me for further question about the words inside the () of Select.
i.e.("[Short Name]=’"+ShortNam.ToString+"’")
Why couldn’t we just use("[Short Name]="+ShortNam.ToString+"")? What’s the purpose of using the extra 2 single quotation marks?

@Allen_Huang

Usually while using value directly we use single quotes.

("[Short Name]=‘CUR’")

For using variable we use like below
("[Short Name]=’"+ShortNam.ToString+"’")

Dear Manjuts,
Thanks a lot!
Got it now.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.