Isomorphic,
I'm seeing the following warning logged for a SelectItem if it uses an option DataSource and the DataSource contains a record where the value field (animalId) is 0.
I'm using SmartClient Version: SNAPSHOT_v10.1d_2015-10-20/Pro Deployment (built 2015-10-20).
I did notice that if I change animalId from an integer field to a text field in the AnimalXmlDS, the warning is not logged.
Entry Point:
AnimalXmlDS.java:
animal.data.xml:
Thanks.
I'm seeing the following warning logged for a SelectItem if it uses an option DataSource and the DataSource contains a record where the value field (animalId) is 0.
Code:
10:02:51.846:TMR3:WARN:fetchMissingValues:isc_SelectItem_1[Animal]:Deriving valueMap for 'animalId' from dataSource based on displayField 'animalName'. This dataSource contains more than one record with animalId set to 0 with differing animalName values. Derived valueMap is therefore unpredictable.
I did notice that if I change animalId from an integer field to a text field in the AnimalXmlDS, the warning is not logged.
Entry Point:
Code:
public void onModuleLoad() {
final DynamicForm form = new DynamicForm();
form.setWidth(500);
SelectItem animal = new SelectItem("Animal");
animal.setOptionDataSource(AnimalXmlDS.getInstance());
animal.setValueField("animalId");
animal.setDisplayField("animalName");
form.setItems(animal);
form.draw();
}
Code:
public class AnimalXmlDS extends DataSource {
private static AnimalXmlDS instance = null;
public static AnimalXmlDS getInstance() {
if (instance == null) {
instance = new AnimalXmlDS("animalDS");
}
return instance;
}
public AnimalXmlDS(String id) {
setID(id);
setRecordXPath("/List/animal");
DataSourceIntegerField animalIdField = new DataSourceIntegerField("animalId");
animalIdField.setHidden(true);
animalIdField.setPrimaryKey(true);
DataSourceTextField animalNameField = new DataSourceTextField("animalName");
setFields(animalIdField, animalNameField);
setDataURL("ds/test_data/animal.data.xml");
setClientOnly(true);
}
}
Code:
<List>
<animal>
<animalId>0</animalId>
<animalName>Cat</animalName>
</animal>
<animal>
<animalId>1</animalId>
<animalName>Dog</animalName>
</animal>
<animal>
<animalId>2</animalId>
<animalName>Giraffe</animalName>
</animal>
<animal>
<animalId>3</animalId>
<animalName>Goat</animalName>
</animal>
<animal>
<animalId>4</animalId>
<animalName>Marmoset</animalName>
</animal>
<animal>
<animalId>5</animalId>
<animalName>Mouse</animalName>
</animal>
</List>
Comment