Hi i am getting some data in db from that i got all phone numbers using for each now what i need to do is i need to save all of them in one variable in this format ‘phn1’,‘phn2’…
how to do it
Hi i am getting some data in db from that i got all phone numbers using for each now what i need to do is i need to save all of them in one variable in this format ‘phn1’,‘phn2’…
how to do it
Hi,
You can try below expression
String PhoneNumbers="'"+String.Join("','",InputDB.AsEnumerable().Select(Function(x) x("PnoneNumber").ToString()).ToList())+"'"
Try the below expression
String.join(",",DT.DefaultView.ToTable(true, "Phonenumber").AsEnumerable().Select(Function (a) a("Phone number").ToString).ToArray())
Hope it will work
Regards
Gokul
@poorna_nayak07 @Gokul001 one more thing actually th db does not have haeders in it so i used row(0).tostring will tis work
Yes it will
i am using assign inside for each and instead of phone number row(0).tostring
so instead of phone number what should i put in
row(0) — getting error does not belong
Try to give only the Index ->0
@manoj_verma1
String.join(“,”, GetfileDT.DefaultView.ToTable(true, “0”).AsEnumerable().Select(Function (a) a(“0”).ToString).ToArray())
same does not belong
Try this expression @manoj_verma1
String.join(",", GetfileDT.DefaultView.ToTable(true, 0).AsEnumerable().Select(Function (a) a(0).ToString).ToArray())
Hey @manoj_verma1 !! I’m going to create a test table just for us to visualize. First let’s convert the column with the phone numbers into an array and with that we get the expected Output. Come with me!!
Step 1: I created the table in this format and I will store it in the DataTable “dt_result”
Step 2: I will transform the column containing the phone numbers into an array of String and I will store them in a variable of type Array of String “arr_phones”
dt_result.AsEnumerable().Select(Function (a) a(0).ToString).ToArray()
String.Join(",",arr_phones)
The result:
Hope it helps!
The .xaml.
Main.xaml (10.2 KB)
in step 1 header is not there like phn number i am getting the data through API
Are you talking about Column Name?
yes column name so i used row(0).to string to get one by one
No problem, we are getting the phone number by column index 0. The name makes no difference.
try using the logic I showed above, it will probably work for you!
@gabrielribas4 it worked but i want to save it like this ‘123’,‘234’,‘456’,…
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.