Returned SQL select value into subj_num field

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Returned SQL select value into subj_num field

Postby akalehzan » Wed Sep 01, 2004 8:12 pm

Hi all,

I'm trying to insert the SQL script return value into a Subj_num field with the following method:
if ( subj_num == null && "controller.newRecord();" )

{
maxRows = 1;
//find the MAX subj_num and add 1
var query = "SELECT MAX(Subj_num) + 1 FROM ID";

var dataset = databaseManager.getDataSetByQuery(controller.getServerName(),query, null, maxRows);
globals.tx30 = '<html>'+dataset.getAsHTML() + '</html>'
}


I like to insert the returned value in to subj_num field which prosperities is not HTML, it is Number.

Or is there way to do the above SQL in JavaScript?

Thanks in advance,


Abrahim
akalehzan
 
Posts: 267
Joined: Mon Mar 29, 2004 8:15 am
Location: Stanford

Postby bcusick » Wed Sep 01, 2004 8:18 pm

Create an aggregate field to get the max id, then on the table where you want the number auto incremented go into dataproviders dialog and click the column and then the "properties" button. Make the result of the calculation.

Bob Cusick
bcusick
 
Posts: 1255
Joined: Wed Apr 23, 2003 11:27 pm
Location: Thousand Oaks, CA USA

Returned SQL select value into subj_num field

Postby akalehzan » Wed Sep 01, 2004 11:02 pm

Bob,

That did it!!

By the way the two days training in Scottsdale Arizona was very helpful.

Thank you very much,

Abrahim
akalehzan
 
Posts: 267
Joined: Mon Mar 29, 2004 8:15 am
Location: Stanford


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 35 guests

cron