I know this will probably be a quick fix, but i am stumped right now…
I have a small part of my larger process that reads an excel into a DT then uses DT.select to assign a variable with the data held in column 2 based on the email address within column 1… Obviously works fine until there isn’t a matching email address within the excel file… I’m trying to put the failing part of the process within a try catch, however when i run it despite it failing for an index outside the bounds of the array it doesn’t like my indexoutofrange exception to continue the process and send an email showing the error…
Copy the whole Sequence present inside Try Catch and delete that Try Catch. Use a new Try Catch and paste the Sequence you copied and check if the error pops up again.
Unfortunately i tried both and it still came up with the same fail…
i even re-wrote the details within each of the assigns etc as I have had a bug before with an assign that was corrected by re-creating it (despite it being exactly the same)…
Checks the email address within variable Testt against column eMail in an excel file and returns the value in the next 2 columns into 2 new variables:
DTSender.Select(“eMAIL= '”+Testt+“'”)(0).Item(1).ToString
DTSender.Select(“eMAIL= '”+Testt+“'”)(0).Item(2).ToString
My assign activity is showing a compiler error:
value of type ‘1-dimensional array of system.data.datarow’ cannot be converted to ‘system.data.datarow’
I set up the variable dtArray as a datarow type all my other variables are string
@DawnW Do not worry so much. Be positive always, there may be mistakes but we always learn from our mistakes, and I clearly like making mistakes as well
Although it shouldn’t be repeated
Also what happened while converting the variable to Array of DataRow ?
I tried your option B with the IF statement as that way of doing it really intersted me in getting that to work too… Unfortunately my assign of dtArray came back with the following error:
My build of DTSender all columns are string
I’m clearly missing something, sorry…
@DawnW Are you using read Range to get the Output form the Excel File ? If so, Why do you need the Build Datatable ? What is the Datatable variable used for Build Datatable and datatable used for Read Range ?
They are both DTSender…
I’m not sure why i have both… This was a part of the process that i wrote a long time ago…
I will delete out the Build and just use the Read range to populate the DTSender…