GeneXus 9.0 Upgrade Course
Languages: All
Objects: Procedures
Interfaces: Win, Web, Text
The
Defined By clause is added to the
New command.
In previous
GeneXus versions, defining a
New command in a procedure sometimes didn't insert the specified records in the desired table. The new
Defined By clause enables to define the table explicitly.
TABLE A CustomerId*
CustomerName
TABLE B TransactionId* with autonumber property set to Yes
CustomerId
Now consider the following
New command:
New
TransactionId = 2
CustomerId = 4
EndNew
To insert a record in Table B you cannot specify the
New command in this way because the TransactionId attribute is autonumbered and can't be assigned (you will view a message such as
spc0030 Line X. Attribute XXX should not be assigned in an insert group. It has the Autonumber property set to No).
On the other hand, you cannot specify the following:
New
CustomerId = 4
EndNew
In this case, the record would be inserted in Table A.
As from this version, in these ambiguous cases you can explicitly specify the desired table of a
New command by using a
Defined By clause. For this reason, the last New command from the examples can now be written as shown below. In this way, you can successfully insert data in Table B.
New
Defined By TransactionId
CustomerId = 4
EndNew
Interesting links
New Command in GeneXus 8.0 Help System