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
[RPG/Javascript] newdbrow function
-
tsupartono
- Posts: 289
- Joined: Wed Apr 18, 2012 10:21 am
Re: [RPG/Javascript] newdbrow function
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)").
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
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.
I went ahead and used the INSERT sql to get the program working, will make a note of this for next time.