[RPG/Javascript] newdbrow function

Please do not use to report errors- use your regional help desk.
Please mark posts as being for RPG or RDMLX (LANSA) developer.
To subscribe by email, display this forum, scroll to the end and select ‘Subscribe Forum’.
Post Reply
DavidS
Posts: 15
Joined: Wed Jan 22, 2014 7:41 pm

[RPG/Javascript] newdbrow function

Post 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
tsupartono
Posts: 289
Joined: Wed Apr 18, 2012 10:21 am

Re: [RPG/Javascript] newdbrow function

Post 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)").
DavidS
Posts: 15
Joined: Wed Jan 22, 2014 7:41 pm

Re: [RPG/Javascript] newdbrow function

Post 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.
Post Reply