jscript onclick rules vs custom code

P

Patrick Temple

I have a form that requires a unique ID, so I created a SQL SERVER database
table to create this ID. I was successful in creating a database connection
to the table that allows me to grab the max(id) from this table. I also
created a stored procedure to insert new ros into the table. The problem I'm
having is two parts.

1) To make sure the user gets a unique ID from the table I want to insert a
row just before I grab the max(id) for the form. The ideal place for this is
part of the custom onclick button code. I was able to create a rule to grab
the max(id) but have to use custom code to call the stored procedure. Does
anyone know what gets called first the rules or the custom code or is there a
way to force an order?

2) My custom code keeps giving me a jscript error. It works fine when I
create a form based on the database connection only but I require other data
connections as well. Any help or thoughts would be appreciated. Here's the
jscript I'm using:

//This code should create a new ID row in the database
//It will also append the date that the new id was created.
//<--------- Create New Id ---------->
var comment = new Date();
XDocument.QueryAdapter.Command = "execute addnewId4 "+ "'" + comment + "'";

//Query the Data Source.
XDocument.Query();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top