I'm using the upload widget for an excel file, and have defined the data structure. I can get it to work & write from Excel to a list structure and then subsequently to an entity no worries. However I want to be able to add some layers to that so as to capture exceptions and give an more intelligent/understandable output for the end user. Uploads will be circa 4000 records, so I want to be able to write out a list of exceptions so the user can go & do lots of edits @ once, rather than 1 edit, reupload, fail & loop.

How do I capture an exception specifically from the ExcelToRecordList function, write that to a list, then continue through the imported file to flag up any other errors (but obviously not do any uploads)?

I've seen that question before around here.

My choice is always to split your work.

1. Upload

ExcelToRecordList to a generic Table where all fields are Text to be tolerant to errors.

That insert will work for sure.

2. Process

Then you can loop the rows and see for each field "is this string a value data? is this string a valid number? Is this string a valid Id from that entity?" and add to each row the error information.

User edits and you recheck until you are happy.

3. Save

Then you move the information to the final Entity with a simple loop and an assign that does all the ConvertTo...



Tips: that temporary table will probably be used concurrently so set a ParentTable to save UserId/FileName/Date and a DetailsTable to save the Excel columns, with an extra boolean field ("IsOk") and an extra text "error message".


Does this solve your problem?