This topic is locked

Beforeinsert

1/4/2013 5:08:27 PM
ASPRunnerPro General questions
D
dexter author

Hello guys
Im using Asprunnerpro 7.0
Im not a programmer that is why may I request that please be specific as possible.
My question is regarding import from excel csv file to the datebase with restrictions or conditions before it will

save to the database.
In the database table, I have one field named "Declaration No" and I put an specific format for this field.

The specific format for the Declaration No is "[0-9]{3}\-[0-9]{8}\-[0-9]{2}" or "999-99999999-99" and max length is 15 characters only.

So, in the "In-line add" or in the "add" page, if the format you put does not meet the format needed then it will not be saved.

However, when I import from excel csv file, no matter what the format is, it will still import the information to the database.
Now, how can I make it not to import the data which doesnt meet the format needed but the rest with the correct format will be uploaded.

and then after it will show how many files were uploaded successfully and how many were not uploaded and will list these unsuccessful uploads.
Again, Im not a programmer. I dont know how to write programs and I dont understand them actually. Im only using asprunner because it says even if you

dont know about programming is still you can use the software. I indeed can use the software and its a big help eversince. Im only having problem with this one

and upon searching is i need to put the codes manually in which im no good at.
If you dont mind. Please be specific as possible. If you can write the code for me then it will be very much appreciated.

Thank you very much and sorry for this novice questions.

Sergey Kornilov admin 1/4/2013

Add and Import are two different processes.
If you need to validate data during import process use BeforeInsert event:

http://xlinesoft.com/asprunnerpro/docs70/before_insert_record.htm
Here is an example. I cannot be 100% sure about syntax, you need to learn about RegExp object at http://msdn.microsoft.com/en-us/library/ms974570.aspx

Set re = New RegExp

re.Pattern = "[0-9]{3}\-[0-9]{8}\-[0-9]{2}"

If re.Test(values("Declaration No")) Then

BeforeInsert = True

Else

BeforeInsert = False

End If