This topic is locked

Check first character on import

7/7/2017 2:49:18 PM
ASPRunner.NET General questions
T
Tim author

Hello,
I am doing an import and I'd like to only import rows that have a numeric value for the first character of one of the fields. If this can be done, I'm assuming I would use "Before insert record" event. And maybe something like:
if (Char.IsDigit(rawvalues["MyField"][0])) {

return true;

} else {

return false;

}
But I am really out of my element with this. Thoughts?
ASPR .Net 9.8, build 29073.
Thanks,

Tim

jadachDevClub member 7/7/2017

I am not 100% sure how to do this during the import, but I would be inclined to import the data as is, then in my database or ASPR Query do something like this.
SELECT ID, Field1, Field2, Field3

FROM dbo.MyTable

WHERE (LEFT(Field1, 1) IN ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'))
OR
SELECT ID, Field1, Field2, Field3

FROM dbo.MyTable

WHERE (ISNUMERIC(LEFT(Field1, 1)) = 1)
Maybe someone else has a cool way to do it as you import.

T
Tim author 7/7/2017

Thanks Jerry. I do run a stored procedure after import to do some other house keeping, so I guess I can add this step too. Good thought. I think I was just hoping for something a bit cleaner; not having to import a bunch of junk records. But it's not that big of deal, really.
Thanks for the input.
Tim