I have a combo box that I would like to use a range value instead of the coded value. What is the proper syntax? Now I am attempting domain.ranges to no avail.
function PopulateQuantity(serviceRequestLayerFieldsQuantity) {
var serviceRequestFieldsQuantity
for (var i = 0; i < serviceRequestLayerFieldsQuantity.length; i++) {
if (serviceRequestLayerFieldsQuantity.name == serviceRequestLayerInfo.QuantityFieldName) {
serviceRequestFieldsQuantity = serviceRequestLayerFieldsQuantity.domain.ranges;
break;
}
}
var Quantity = { identifier: "id", items: [] };
for (var i = 0; i < serviceRequestFieldsQuantity.length; i++) {
serviceRequestFieldsQuantity.items = { id: serviceRequestFieldsQuantity.name, name: serviceRequestFieldsQuantity.name };
}
var QuantityStore1 = new dojo.data.ItemFileReadStore({ data: QuantityFieldType });
dijit.byId('cbQuantity').attr('store', QuantityStore1);
}
function PopulateQuantity(serviceRequestLayerFields) {
var serviceRequestFields
for (var i = 0; i < serviceRequestLayerFields.length; i++) {
if (serviceRequestLayerFields.name == serviceRequestLayerInfo.QuantityFieldName) {
serviceRequestFields = serviceRequestLayerFields.domain.ranges;
break;
}
}
var QuantityType = { identifier: "id", items: [] };
for (var i = 0; i < serviceRequestFields.length; i++) {
QuantityType.items = { id: serviceRequestFields.name, name: serviceRequestFields.name };
}
var QuantityStore = new dojo.data.ItemFileReadStore({ data: QuantityType });
dijit.byId('cbQuantity').attr('store', QuantityStore);
}
Hi Geoffrey,
Range value domain is a not an array of values like coded value domain, it is a range between minimum and maximum value.
Hi Riyas,
Thank you for your note. I understand that the range value is not an array like coded values, however, could you please point me to the syntax of range value? I would like to reference a range of 1-99.
Did you try
serviceRequestLayerFields.domain.minValue;
serviceRequestLayerFields.domain.maxValue;
should work, if your field has range value domain.
Hi Riyas,
Thank you for your note, this does not work. I also do not receive any errors in my console either.
function PopulateQuantity(serviceRequestLayerFieldsQuantity) {
var serviceRequestFieldsQuantity
for (var i = 0; i < serviceRequestLayerFieldsQuantity.length; i++) {
if (serviceRequestLayerFieldsQuantity.name == serviceRequestLayerInfo.QuantityFieldName) {
serviceRequestFieldsQuantity = serviceRequestLayerFieldsQuantity.domain.minValue;
break;
}
}
var Quantity = { identifier: "id", items: [] };
for (var i = 0; i < serviceRequestFieldsQuantity.length; i++) {
serviceRequestFieldsQuantity.items = { id: serviceRequestFieldsQuantity.name, name: serviceRequestFieldsQuantity.name };
}
var QuantityStore1 = new dojo.data.ItemFileReadStore({ data: QuantityFieldType });
dijit.byId('cbQuantity').attr('store', QuantityStore1);
}
function PopulateQuantity(serviceRequestLayerFields) {
var serviceRequestFields
for (var i = 0; i < serviceRequestLayerFields.length; i++) {
if (serviceRequestLayerFields.name == serviceRequestLayerInfo.QuantityFieldName) {
serviceRequestFields = serviceRequestLayerFields.domain.maxValue;
break;
}
}
var QuantityType = { identifier: "id", items: [] };
for (var i = 0; i < serviceRequestFields.length; i++) {
QuantityType.items = { id: serviceRequestFields.name, name: serviceRequestFields.name };
}
var QuantityStore = new dojo.data.ItemFileReadStore({ data: QuantityType });
dijit.byId('cbQuantity').attr('store', QuantityStore);
}
Hi Geoffrey,
Have a look at this fiddle, Edit fiddle - JSFiddle is this what you are after?
Hi Riyas,
This solution is not successful. I have domains chosen as short integer from 0-99 on my database side. See my edited code below.
unction PopulateQuantity(serviceRequestLayerFieldsQuantity) {
var serviceRequestFieldsQuantity
for (var i = 0; i < serviceRequestLayerFieldsQuantity.length; i++) {
if (serviceRequestLayerFieldsQuantity.name == serviceRequestLayerInfo.QuantityFieldName) {
serviceRequestFieldsQuantity = serviceRequestLayerFieldsQuantity.domain.minValue + "-" + serviceRequestFieldsQuantity.domain.maxValue;
break;
}
}
var Quantity = { identifier: "id", items: [] };
for (var i = 0; i < serviceRequestFieldsQuantity.length; i++) {
serviceRequestFieldsQuantity.items = { id: serviceRequestFieldsQuantity.name, name: serviceRequestFieldsQuantity.name };
}
var QuantityStore1 = new dojo.data.ItemFileReadStore({ data: QuantityFieldType });
dijit.byId('cbQuantity').attr('store', QuantityStore1);
}
function PopulateQuantity(serviceRequestLayerFields) {
var serviceRequestFields
for (var i = 0; i < serviceRequestLayerFields.length; i++) {
if (serviceRequestLayerFields.name == serviceRequestLayerInfo.QuantityFieldName) {
serviceRequestFields = serviceRequestLayerFieldsQuantity.domain.minValue + "-" + serviceRequestFieldsQuantity.domain.maxValue;
break;
}
}
var QuantityType = { identifier: "id", items: [] };
for (var i = 0; i < serviceRequestFields.length; i++) {
QuantityType.items = { id: serviceRequestFields.name, name: serviceRequestFields.name };
}
var QuantityStore = new dojo.data.ItemFileReadStore({ data: QuantityType });
dijit.byId('cbQuantity').attr('store', QuantityStore);
}
Hi geoffery,
Can you provide bit more detail on what you use case is? I'm bit confused on what is that you are exactly after
Hi Riyas,
Please see Public Information Center
I have an application using this template and I have added a number of other requests fields such as quantity. See my screen shot. I would like the quantity field to be a value domain.
Hi Geoffrey,
Have a look at this fiddle Edit fiddle - JSFiddle
You can use a function like convertRangeToCode and pass your fields with domain to this function, it'll convert the range domain into a coded value domain json object which you can use to populate your dropdown list.
If the domain in already a coded value domain, it'll be returned as is.