There is a way to link fields together in the header. Using the linkedElement/filterColumn/linkColumn /filterColumn attributes.
Step-by-step guide - "filter"
Before using the filter function, you must setup the following in GetReferenceData
- Write the table "MasterTable".
- Write the table "SlaveTable".
- In the header configure "Master" as:
id = 5
name = TestMaster
inputType = List
dataTable = MasterTable
dataKeyColumn = MasterKey
dataDisplayColumn = MasterName
linkedElement = 6 - This points to the slave list. - In the header configure "Slave" as:
id = 6
name = TestSlave
inputType = List
dataTable = SlaveTable
dataKeyColumn = SlaveKey
dataDisplayColumn = SlaveName
filterColumn = SlaveMasterKey - This points to the column in SlaveTable to filter the values on.
Step-by-step guide - "linkColumn"
This method will change the value of another field when a specific field is changed.
The "Slave" field can be changed afterwards, but if "Master" is changed, the "Slave" will receive a new value.
Demo, in GetReferenceData do the following.
- Write the table "MasterTable.
- In the header configure "Master" as:
id = 5
name = TestMaster
inputType = List
dataTable = MasterTable
dataKeyColumn = MasterKey
dataDisplayColumn = MasterName
linkedElement = 6 - This points to the slave field.
linkColumn = MasterKey - This is the value we want to be transfered to slave field - In the header configure "Slave" as:
id = 6
name = TestSlave
inputType = Text
Whenever the "Master" field is change - the "Key" from the MasterTable is copied to the "Slave" field.
...
...
title | AX |
---|
Example: this is used in Unplanned Move. Look a class Mob_GetReferenceData.addUnplannedMoveHeader(..)
It is used to set "To warehouse" to the same value as "From warehouse", but the "To warehouse" can be changed afterwards.
...
...
...
void addUnplannedMoveHeader(XmlElement linesElement)
{
// Warehouse to move from
this.addDefaultWarehouseElement(linesElement, 1, #ReferenceDataTable_WarehouseList, #FromWarehouse, "@SYS25253", '2', #Warehouse_InventLocationId);
// Warehouse to move to
this.addDefaultWarehouseElement(linesElement, 2, #ReferenceDataTable_WarehouseList2, #ToWarehouse, "@SYS8519");
// Item number text box
this.addDefaultItemNumberElement(linesElement, 3);
}
Tables used
For the examples, this data is used to demo the functionality.
MasterTable
MasterKey | MasterName |
---|---|
M1 | Bike |
M2 | Car |
M3 | Truck |
The 2 tables are linked so the MasterTable.MasterKey --> SlaveTable.SlaveMasterKey
SlaveTable
SlaveMasterKey | SlaveKey | SlaveName |
---|---|---|
M1 | S1 | City bike |
M1 | S2 | Mountainbike bike |
M1 | S3 | Motor bike |
M2 | S5 | Sports car |
M2 | S6 | MPV |
M2 | S7 | Wargon |
M3 | S9 | Just Truck |
Info |
---|
|
Related articles
Filter by label (Content by label) | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
hidden | true |
---|
...