Table
Purpose¶
Cross reference table lookup.
Methods¶
Binding name: table
Method: String[] lookup(String tableId, Map keys, String fieldName)
Performs a lookup on the given cross reference tableId
using the Map of keys
. Only fieldName
values will be returned.
Method: Map[] lookup(String tableId, Map keys)
Performs a lookup on the given cross reference tableId
using the Map of keys
.
The table records found are returned as an array of Maps of fieldName and values.
Method: void upsertRecords(String tableId, List<Map<String, String>> records)
Upsert the records
in the table named tabledId
.
If a new record has the same values for the primary keys than an existing record, the existing record’s values are updated with the new ones.
If not, the new record is added to the table.
If the list of records is empty, nothing happens.
Method: Map[] toList(String tableId)
Performs a lookup on the given cross reference tableId
returning all rows and values.
Method: GPathResult toXml(String tableId, String xmlTemplateText)
Performs a lookup on the given cross reference tableId
returning all rows and values expressed as XML.
xmlTemplateText
is optional. Use this to override the internal XML template used.
Method: org.w3c.dom.Document toDom(String tableId, String xmlTemplateText)
Performs a lookup on the given cross reference tableId
returning all rows and values expressed as a DOM.
xmlTemplateText
is optional. Use this to override the internal XML template used.
Default table XML structure:
<table> <TABLENAME> <rows> <row id="0"> <key id="FIELDNAME1">fvalue1</key> <key id="FIELDNAME2">fvalue2</key> </row> </rows> </TABLENAME> </table>
Examples¶
Accessing cross reference table records:
def records = table.lookup("Customers", [Cust_ERP_Identifier: "MHP"]) println records
if(table.lookup("Customers", [Cust_ERP_Identifier: "MHP"], "Invoice_Aggregation") == ["true"]){ println "Invoice aggregation is required!" }