Hello I am having a problem with displaying an interface specifically for orders in a grid. The lines specifically in question are 120, 168, and 170 those are where the errors begin. I am wondering how to fix and where it went wrong so in the future we can not have this issue again.
Here is the error:
Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function a!gridField [line 120]: A grid component [label=“Read-only Grid”] has an invalid value for “columns”. A grid column [label=“STATUS”] has encountered an error. Expression evaluation error at function 'choose' [line 170]: Choose index cannot be null.
Here is the Code:
a!localVariables( local!data:a!refreshVariable( value: a!queryEntity( entity: cons!MAP_DSE_ORDER, query: a!query( logicalExpression: a!queryLogicalExpression( operator: "OR", filters: { a!queryFilter( field: "priority", operator: "in", value: ri!priority ), a!queryFilter( field: "name", operator: "includes", value: ri!search ), a!queryFilter( field: "description", operator: "includes", value: ri!search ), a!queryFilter( field: "dueDate", operator: "between", value: ri!date ) }, ignoreFiltersWithEmptyValues: true ), pagingInfo: a!pagingInfo(1,-1) ), fetchTotalCount: true ).data, refreshOnReferencedVarChange: true ), { a!richTextDisplayField( label: "Rich Text", labelPosition: "COLLAPSED", value: { a!richTextHeader( text: { "ORDERS" } ) } ), a!sideBySideLayout( items: { a!sideBySideItem( item: a!textField( label: "SEARCH", labelPosition: "ABOVE", placeholder: "Search by or description", value: ri!search, saveInto: ri!search, refreshAfter: "UNFOCUS", validations: {} ) ), a!sideBySideItem( item: a!multipleDropdownField( label: "PRIORITY", labelPosition: "ABOVE", placeholder: "--- Select a Value ---", choiceLabels: { "1", "2","3","4" }, choiceValues: { 1,2,3,4 }, value: ri!priority, saveInto: ri!priority ) ), a!sideBySideItem( item: a!dropdownField( label:"DUE DATE", placeholderLabel: "--- Select a Value ---", choiceLabels: { "Next Week", "Next Two Weeks", "Next Month", "Next Three Months", "Next Six Months" }, choiceValues: a!forEach( {7,14,30,90,180}, today()+fv!item ), value:ri!date, saveInto: a!save(ri!date,{today(),save!value}) ) ), a!sideBySideItem( item: a!richTextDisplayField( label: "Rich Text", labelPosition: "COLLAPSED", value: { a!richTextItem( text: { a!richTextIcon(icon:"close"), "Clear Filters" }, link: a!dynamicLink(value:null, saveInto:{ri!priority, ri!search, ri!date}), /*linkStyle: "STANDALONE",*/ color: "ACCENT" ) } ), width: "MINIMIZE" ) }, alignvertical: "BOTTOM" ), a!gridField( label: "Read-only Grid", labelPosition: "COLLAPSED", data:local!data, columns: { a!gridColumn( label: "Name", sortField: "name", value: a!linkField( links:a!recordLink( label:fv!row.name, recordType: cons!MAP_RECORD_TYPE_ORDER, identifier: fv!row.id ) ) ), a!gridColumn( label: "Description", sortField: "description", value: fv!row.description ), a!gridColumn( label: "Priority", sortField: "priority", value: a!richTextDisplayField(value:rule!MAP_circles( total:4, filled:fv!row.priority )) ), a!gridColumn( label: "Due Date", sortField: "dueDate", value: fv!row.dueDate /*align: "END"*/ ), a!gridColumn( label: "Requirements", value: a!richTextDisplayField( value:a!richTextBulletedList( items:a!forEach( fv!row.contents.contentItem, a!richTextListItem(text:fv!item.name) ) ) ) ), a!gridColumn( label:"STATUS", align: "CENTER", value:a!richTextDisplayField(value: choose( fv!row.status+1, a!richTextIcon( icon: "check-circle", caption:"On Schedule", color: "POSITIVE", size: "MEDIUM_PLUS" ), a!richTextIcon( icon: "exclamation-circle", caption:"Due Soon", color: "#ffcd4e", size: "MEDIUM_PLUS" ), a!richTextIcon( icon: "times-circle", caption:"Overdue", color: "NEGATIVE", size: "MEDIUM_PLUS" ) ) ) ) }, validations: {} ) } )
Discussion posts and replies are publicly visible
The error says "Choose index cannot be null" which means the first parameter in choose() can't be null. Your first parameter is 'fv!row.status+1'. If fv!row.status does not translate to a number, this could cause an issue. I recommend using a small if() statement to first see if fv!row.status is null using the isnull() function.
How would this statement look, I am not very familiar with expression mode unfortunately. I am sorry for being a burden but this is a huge blocker for our team currently.
if( isnull(fv!row.status), a!richTextIcon()/*some default icon*/, choose( fv!row.status+1, a!richTextIcon( icon: "check-circle", caption:"On Schedule", color: "POSITIVE", size: "MEDIUM_PLUS" ), a!richTextIcon( icon: "exclamation-circle", caption:"Due Soon", color: "#ffcd4e", size: "MEDIUM_PLUS" ), a!richTextIcon( icon: "times-circle", caption:"Overdue", color: "NEGATIVE", size: "MEDIUM_PLUS" ) ) ) )