close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Check if value exists before Insert

Thread began 11/22/2010 10:24 pm by Brad Lawryk | Last modified 11/23/2010 11:23 am by Jason Byrnes | 2317 views | 7 replies |

Brad Lawryk

Check if value exists before Insert

I have a form that is a normal insert form and it works fine. But what I need to do is compare one of the values in a text field to make sure it exists in another table before it Inserts.

So basically I am inserting a record into Table B, But I need to make sure that the value entered in one of the text fields is present in Table A before Inserting.

Is there a way to do this?

Thanks,
Brad

Sign in to reply to this post

CraigRBeta Tester

you could try adding a recordset using table A, filtered by the post value of your form field

on your page, when the add record form is posted, the recordset will return 0 rows unless you have a match.

if you have a match, do the insert, if not, don't.

Sign in to reply to this post

Brad Lawryk

Thanks for your advice Craig, but I don't see how that would work?

Creating the recordset for Table A will of course be empty because there is nothing to filter it by until the form is posted.

So I don't see how that can stop the form from inserting if you have to insert it in order for it to get the form value?

Sign in to reply to this post

Jason ByrnesWebAssist

If you have the code ordered correctly, the record set will be created before the insert occurs, this will allow you to look up the value in the recordset and only perform the insert if the recordset is not empty.

Sign in to reply to this post

Brad Lawryk

Originally Said By: Jason Byrnes
  If you have the code ordered correctly, the record set will be created before the insert occurs, this will allow you to look up the value in the recordset and only perform the insert if the recordset is not empty.  



Thanks Jason,

So it would have to be hand coded .... its not something that Data Assist has in it?

Brad

Sign in to reply to this post

Jason ByrnesWebAssist

no, no hand codeing needed, but the wizard will not create the it for you.


you just need to create the recordset, set it to filter using the form input.

then edit the insert record behavior and set the trigger to Recordset Not Empty.

Sign in to reply to this post

Brad Lawryk

Thanks Jason,

Much appreciated, I'll give it a try.

Brad

PS Off topic: Your Framework Extension is fantastic .... its a must have now.

Sign in to reply to this post

Jason ByrnesWebAssist

excellent, I'm glad to hear it is working out for you.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...