kavya.s16
(Kavya S16)
March 18, 2022, 5:28am
1
Hi everyone
My issue is I have a datatable with 6 rows of email address , out of which one is empty
There is another datatable so what i am doing is
OtherDatatable.select(“EmailID='”+in_Datarow(“EmailId”).toString+“'”).copydatatable
This in_Datarow is each row of that emailAddress datatable , so i when that empty row comes in picture like this , the above expression throws error source contains no datarow
Thanks in advance
Gokul001
(Gokul Balaji)
March 18, 2022, 5:39am
2
Hi @kavya.s16
Try this expression
OtherDatatable.select("EmailID='"+If(in_Datarow.ToString.Equals(""),in_Datarow("EmailId").toString,String.Empty)+"’").CopyToDataTable
Regards
Gokul
kavya.s16
(Kavya S16)
March 18, 2022, 5:56am
3
Hi @Gokul001 i tried ur expression , i got invalid constant “”
what about this string.isnullorEmpty(in_Datarow(“EmailId”).tostring)
returns true for that empty email address in datarow
now how can i assign “” to a datarow?
Gokul001
(Gokul Balaji)
March 18, 2022, 6:00am
4
Can you share the screenshot @kavya.s16
Regards
Gokul
Gokul001
(Gokul Balaji)
March 18, 2022, 6:02am
5
Try to use this expression @kavya.s16
DtMaster.select("EmailID='"+If(String.IsNullOrEmpty(in_Datarow("EmailId").tostring),in_Datarow("EmailId").toString,String.Empty)+"’").CopyToDataTable
Regards
Gokul
kavya.s16
(Kavya S16)
March 18, 2022, 6:29am
6
still same error - The expression contains invalid string constant :‘’.
sorry couldnt share screentshot as its client data @Gokul001
Gokul001
(Gokul Balaji)
March 18, 2022, 6:30am
7
Hi @kavya.s16
If possible can you share the sample XAML file
Regards
Gokul
kavya.s16
(Kavya S16)
March 18, 2022, 6:32am
8
@Gokul001 actually not possible as its client related
Hi
Try something like this
dt = dt.AsEnumerable().Where(Function(a) a.Field(of String)(“EmailID”).ToString.Contains(
IF(String.IsNullOrEmpty(in_Datarow(“EmailId”).ToString), String.Empty, in_Datarow(“EmailId”).ToString)) ).CopyToDatatable
Cheers @kavya.s16
Hi @kavya.s16 ,
Are you trying to assign the Email value to the Original DataTable which doesn’t contain it?
Assuming that there is only a single instance of the Email Field being empty,you can first find the index of that empty row using this →
idx = OriginalDT.AsEnumerable().ToList().FindIndex(Function(f) IsNothing(f("EmailId").ToString) OrElse String.IsNullOrEmpty(f("EmailId").ToString))
Now that we have our index, all that is left is to assign the Email to that particular field using this →
OriginalDT.Rows(idx)("EmailId") = in_Datarow(“EmailId”).toString
Kind Regards,
Ashwin A.K
ushu
(Usha kiranmai)
March 18, 2022, 6:37pm
11
@kavya.s16 Why don’t you filter the empty values first if any, and then copy the values to other datatable ?