Be sure your post includes:
1. SmartClient Version: v9.0p_2013-11-14/PowerEdition Deployment (built 2013-11-14
2. Firefox 26.0
Hello,
I have a datasource ds.xml with defining a number of fields that were given a name different from the column name in the database (server type is "sql"):
<?xml version="1.0" encoding="UTF-8"?>
<DataSource ID="Item" dataFormat="iscServer" serverType="sql" webServiceOperations="all"
dbName="as400" sparseUpdates="true" tableName="IPITHDR"
serverConstructor="com.islandpacific.gui.server.cu stomDataSource.ItemDS"
title="Item" pluralTitle="Items"
titleField="itemNumber" infoField="itemDescription"
quickSearchFields="itemNumber,itemDescription">
<fields>
<field name="zone" nativeName="IZONE" title="Zone" type="integer"
release="4.1" hidden="true"
customCriteriaExpression="'1'='1'"
customSelectExpression="#if($advancedCriteria.zone || $primaryDSRequest.getFieldValue('zone') ) IPIZHDR.IZONE #else 0 #end"
customInsertExpression="$values.zone"
customUpdateExpression="$values.zone">
</field>
<field name="concept" nativeName="ICNCPT" title="Concept" type="integer"
release="4.1" menuItem="Item>" detail="true" canEdit="false" />
<field name="division" nativeName="IDIV" title="Division" type="integer"
menuItem="Item>" detail="true" canEdit="false" />
<field name="department" nativeName="IDPT" title="Department"
menuItem="Item>" type="integer" detail="true" canEdit="false" />
<field name="subDepartment" nativeName="ISBD" title="Subdepartment"
menuItem="Item>" type="integer" detail="true" canEdit="false" />
<field name="itemClass" nativeName="ICLS" title="Class" type="integer" align="left" detail="true"
menuItem="Item>" primaryKey="true" editorType="ComboBoxItem" completeOnTab="true" required="true"
optionDataSource="IPCLASS" valueField="CCLS" displayField="CLNM" width="220" tab="Basics">
<filterFields>CLNM</filterFields>
<filterFields>CCLS</filterFields>
<pickListFields>
<ListGridField name="CLNM" width="150"/>
<ListGridField name="CCLS" width="50"/>
</pickListFields>
</field>
<field name="itemVendor" nativeName="IVEN" title="Vendor" type="integer" align="left" detail="true"
menuItem="Item>" primaryKey="true" editorType="ComboBoxItem" completeOnTab="true" required="true"
optionDataSource="IPMRVEN" valueField="VVEN" displayField="VNAM" width="220" tab="Basics">
<filterFields>VNAM</filterFields>
<filterFields>VVEN</filterFields>
<pickListFields>
<ListGridField name="VNAM" width="150"/>
<ListGridField name="VVEN" width="50"/>
</pickListFields>
</field>
.........
In the code I'm defining the datasource and then bind it to my grid, fetch the data and load it.
When I start the grid none of the fields with different native names show. I have to explicitly load them:
RecordList newRecords = new RecordList();
for (Record record : records.toArray()) {
record.setAttribute(ITEM_COLOR, record.getAttribute(ICLR));
record.setAttribute(ITEM_SIZE, record.getAttribute(ISIZ));
record.setAttribute(ITEM_DESCRIPTION, record.getAttribute(IDES));
record.setAttribute(SHORT_DESCRIPTION, record.getAttribute(ISDS));
record.setAttribute(VENDOR_STYLE, record.getAttribute(IVST));
record.setAttribute(LAST_VENDOR_COST, record.getAttribute(IVNC));
record.setAttribute(BOOK_RETAIL, record.getAttribute(IRET));
record.setAttribute(ITEM_NUMBER, record.getAttribute(ICLS) + "-" +
record.getAttribute(IVEN) + "-" + record.getAttribute(ISTY) + "-" +
record.getAttribute(ICLR) + "-" + record.getAttribute(ISIZ));
if (record.getAttributeAsBoolean(PARTIAL_REC)==true) {
newRecords.add(new Record(record.getJsObj()));
continue;
}
// Copy this record into a new Record object for editing.
Record newRecord = new Record(record.getJsObj());
newRecords.add(newRecord);
}
getGrid().setData(newRecords);
Then when I save the grid I have to do the reverse, load the new values from the "name"s into the "nativeName"s and then save.
If I set the field "name"s to the database column name everything works fine.
Thanks,
Cristian
1. SmartClient Version: v9.0p_2013-11-14/PowerEdition Deployment (built 2013-11-14
2. Firefox 26.0
Hello,
I have a datasource ds.xml with defining a number of fields that were given a name different from the column name in the database (server type is "sql"):
<?xml version="1.0" encoding="UTF-8"?>
<DataSource ID="Item" dataFormat="iscServer" serverType="sql" webServiceOperations="all"
dbName="as400" sparseUpdates="true" tableName="IPITHDR"
serverConstructor="com.islandpacific.gui.server.cu stomDataSource.ItemDS"
title="Item" pluralTitle="Items"
titleField="itemNumber" infoField="itemDescription"
quickSearchFields="itemNumber,itemDescription">
<fields>
<field name="zone" nativeName="IZONE" title="Zone" type="integer"
release="4.1" hidden="true"
customCriteriaExpression="'1'='1'"
customSelectExpression="#if($advancedCriteria.zone || $primaryDSRequest.getFieldValue('zone') ) IPIZHDR.IZONE #else 0 #end"
customInsertExpression="$values.zone"
customUpdateExpression="$values.zone">
</field>
<field name="concept" nativeName="ICNCPT" title="Concept" type="integer"
release="4.1" menuItem="Item>" detail="true" canEdit="false" />
<field name="division" nativeName="IDIV" title="Division" type="integer"
menuItem="Item>" detail="true" canEdit="false" />
<field name="department" nativeName="IDPT" title="Department"
menuItem="Item>" type="integer" detail="true" canEdit="false" />
<field name="subDepartment" nativeName="ISBD" title="Subdepartment"
menuItem="Item>" type="integer" detail="true" canEdit="false" />
<field name="itemClass" nativeName="ICLS" title="Class" type="integer" align="left" detail="true"
menuItem="Item>" primaryKey="true" editorType="ComboBoxItem" completeOnTab="true" required="true"
optionDataSource="IPCLASS" valueField="CCLS" displayField="CLNM" width="220" tab="Basics">
<filterFields>CLNM</filterFields>
<filterFields>CCLS</filterFields>
<pickListFields>
<ListGridField name="CLNM" width="150"/>
<ListGridField name="CCLS" width="50"/>
</pickListFields>
</field>
<field name="itemVendor" nativeName="IVEN" title="Vendor" type="integer" align="left" detail="true"
menuItem="Item>" primaryKey="true" editorType="ComboBoxItem" completeOnTab="true" required="true"
optionDataSource="IPMRVEN" valueField="VVEN" displayField="VNAM" width="220" tab="Basics">
<filterFields>VNAM</filterFields>
<filterFields>VVEN</filterFields>
<pickListFields>
<ListGridField name="VNAM" width="150"/>
<ListGridField name="VVEN" width="50"/>
</pickListFields>
</field>
.........
In the code I'm defining the datasource and then bind it to my grid, fetch the data and load it.
When I start the grid none of the fields with different native names show. I have to explicitly load them:
RecordList newRecords = new RecordList();
for (Record record : records.toArray()) {
record.setAttribute(ITEM_COLOR, record.getAttribute(ICLR));
record.setAttribute(ITEM_SIZE, record.getAttribute(ISIZ));
record.setAttribute(ITEM_DESCRIPTION, record.getAttribute(IDES));
record.setAttribute(SHORT_DESCRIPTION, record.getAttribute(ISDS));
record.setAttribute(VENDOR_STYLE, record.getAttribute(IVST));
record.setAttribute(LAST_VENDOR_COST, record.getAttribute(IVNC));
record.setAttribute(BOOK_RETAIL, record.getAttribute(IRET));
record.setAttribute(ITEM_NUMBER, record.getAttribute(ICLS) + "-" +
record.getAttribute(IVEN) + "-" + record.getAttribute(ISTY) + "-" +
record.getAttribute(ICLR) + "-" + record.getAttribute(ISIZ));
if (record.getAttributeAsBoolean(PARTIAL_REC)==true) {
newRecords.add(new Record(record.getJsObj()));
continue;
}
// Copy this record into a new Record object for editing.
Record newRecord = new Record(record.getJsObj());
newRecords.add(newRecord);
}
getGrid().setData(newRecords);
Then when I save the grid I have to do the reverse, load the new values from the "name"s into the "nativeName"s and then save.
If I set the field "name"s to the database column name everything works fine.
Thanks,
Cristian