Page 1 of 1

[RPG/Javascript] newdbrow function

Posted: Thu Nov 05, 2015 10:25 pm
by DavidS
Hello,

In RPG Example 303 - "Browse TutorialContacts" there's an add new row button with the following operation:
OnClick.Operation +
( +
Type : NewDbRow
) +
&.Tbl: TutorialContacts

I'm trying to convert this into something that is used in a javascript for an offline form, I assume what I want is some sort of:
this.q_setProperties( { 'RunOperation.Type':'NewDbRow',
'RunOperation.Tbl':'SAVEDTABLE'} );
command, but I can't get the syntax right, I've tried:
Runoperation.tbl
&tbl
&.tbl

which all come back as unrecognsied. I'm probably missing something very obvious but would appreciate if someone could point it out please.

Thanks

Re: [RPG/Javascript] newdbrow function

Posted: Fri Nov 06, 2015 11:07 am
by tsupartono
Hi David,

The '&.Tbl: TutorialContacts' actually belongs to the button, instead of to the NewDbRow operation.
The 'NewDbRow' operation does not have any explicit parameter. It takes the context from the entity that initiates that operation (in that example, it's the button).

So, in your ECL that sets the RunOperation properties, you don't need to specify the table there.

Instead, your element or one of its parents (e.g. the form) must be bound to the table SAVEDTABLE.

Alternatively, you can also insert the new row in the ECL directly using the q_sql("INSERT INTO SAVEDTABLE VALUES(xxx)").

Re: [RPG/Javascript] newdbrow function

Posted: Fri Nov 06, 2015 10:05 pm
by DavidS
Thanks, told you it would be something obvious I was missing :)
I went ahead and used the INSERT sql to get the program working, will make a note of this for next time.