So I have this code that works when I test the interface, but when the test values are empty it displays this:
I want to still display the interface while the index List is empty. I tried a few things but so far nothing has worked.
Here's the text field's code:
a!textField( label: "Program", labelPosition: "ABOVE", value: index(local!program[ri!tpsRequest['recordType!{63733d83-c1fa-4244-bcca-b0ddcccccbf4}DS_TPS.fields.{dbc3f6e3-0ead-4aec-969e-561c93c12055}programID']], 'recordType!{0ad1112a-64a6-465e-99da-48e839d78914}APR Program.fields.{64faa577-dd6f-4073-902d-57142bb77458}name'), align: "LEFT", readonly: true, ),
And here's the entirety of the code:
{ a!sectionLayout( contents: rule!ACE_SCT_DynamicBreadCrumbTrail(isInterfaceDark: false, recordName: cons!ASK_TEXT_LABEL_REQUEST), divider: "BELOW" ), rule!ASK_SCT_RequestDetails(request: ri!request), a!sectionLayout( contents: { rule!ASK_CMPT_RequestItem( requestId: ri!request['recordType!{2ae53002-5d92-42a2-9e49-f4da57bb5aa7}ASK Request.fields.{ed63ad73-08ba-4d6b-9c2f-1ce50a57539d}requestId'], creator: ri!request['recordType!{2ae53002-5d92-42a2-9e49-f4da57bb5aa7}ASK Request.fields.{44296bb8-930b-4e55-9167-99f4b89703b3}createdBy'] ) }, marginAbove: "STANDARD" ), a!sectionLayout( contents: { rule!ASK_CMPT_requestDocuments( requestId: ri!request['recordType!{2ae53002-5d92-42a2-9e49-f4da57bb5aa7}ASK Request.fields.{ed63ad73-08ba-4d6b-9c2f-1ce50a57539d}requestId'] ) }, marginAbove: "STANDARD" ), a!localVariables( local!program: rule!DS_GetProgramById(ri!tpsRequest['recordType!{63733d83-c1fa-4244-bcca-b0ddcccccbf4}DS_TPS.fields.{dbc3f6e3-0ead-4aec-969e-561c93c12055}programID']), local!subsystem: rule!DS_GetSubsystemById(ri!tpsRequest['recordType!{63733d83-c1fa-4244-bcca-b0ddcccccbf4}DS_TPS.fields.{d60344f1-87aa-4adc-852f-13a6f0c0a4b1}subSystemID']), a!sectionLayout( label: "TPS Requestor Input:", labelSize: "MEDIUM", labelColor: "#434343", contents: { a!columnsLayout( columns: { a!columnLayout( contents: { a!textField( label: "Program", labelPosition: "ABOVE", value: index(local!program[ri!tpsRequest['recordType!{63733d83-c1fa-4244-bcca-b0ddcccccbf4}DS_TPS.fields.{dbc3f6e3-0ead-4aec-969e-561c93c12055}programID']], 'recordType!{0ad1112a-64a6-465e-99da-48e839d78914}APR Program.fields.{64faa577-dd6f-4073-902d-57142bb77458}name'), align: "LEFT", readonly: true, ), a!textField( /*working!*/ label: "Subsystem", labelPosition: "ABOVE", value: index(local!subsystem, 'recordType!{d76a6e25-762d-4976-a4e7-c4c6dd9a9078}APR Subsystem.fields.{ae57477a-ebae-40fb-afd9-eff4d99b175a}name', "-"), align: "LEFT", readonly: true, ), a!columnsLayout( columns: { a!columnLayout( contents: { a!dateField( label: "TPS Need Date", labelPosition: "ABOVE", helpTooltip: "When TPS is needed by.", value: a!defaultValue( ri!tpsRequest['recordType!{63733d83-c1fa-4244-bcca-b0ddcccccbf4}DS_TPS.fields.{e58bfbb2-7937-4018-badb-7dcb99407bd5}TPSNeed'], "N/A"), saveInto: ri!tpsRequest['recordType!{63733d83-c1fa-4244-bcca-b0ddcccccbf4}DS_TPS.fields.{e58bfbb2-7937-4018-badb-7dcb99407bd5}TPSNeed'], required: true, readOnly: true, validations: {} ), a!dateField( label: "Proposed End Date", labelPosition: "ABOVE", helpTooltip: "Proposed end date for completed work", value: a!defaultValue( ri!tpsRequest['recordType!{63733d83-c1fa-4244-bcca-b0ddcccccbf4}DS_TPS.fields.{a0d54b00-c10e-4e2e-bdf7-fa7353b672f4}proposedDate'], "N/A"), saveInto: ri!tpsRequest['recordType!{63733d83-c1fa-4244-bcca-b0ddcccccbf4}DS_TPS.fields.{a0d54b00-c10e-4e2e-bdf7-fa7353b672f4}proposedDate'], required: true, readOnly: true, validations: {} ) } ) }, marginAbove: "NONE", marginBelow: "NONE" ) }, width: "MEDIUM" ), a!columnLayout( contents: { a!sideBySideLayout( items: { a!sideBySideItem( item: a!textField( label: "Task Location", labelPosition: "ABOVE", helpTooltip: "Current building and lab location of the task.", value: ri!tpsRequest['recordType!{63733d83-c1fa-4244-bcca-b0ddcccccbf4}DS_TPS.fields.{2b3a1ca7-d736-4625-8321-89dea463481e}taskLocation'], saveInto: ri!tpsRequest['recordType!{63733d83-c1fa-4244-bcca-b0ddcccccbf4}DS_TPS.fields.{2b3a1ca7-d736-4625-8321-89dea463481e}taskLocation'], refreshAfter: "UNFOCUS", required: true, readOnly: true, validations: {} ) ), a!sideBySideItem( item: a!textField( label: "Hardware Class", labelPosition: "ABOVE", placeholder: "Hardware Class", value: ri!tpsRequest['recordType!{63733d83-c1fa-4244-bcca-b0ddcccccbf4}DS_TPS.fields.{1b3a0669-e51a-4b77-aa57-7002d19e9610}hardwareClass'], saveInto: ri!tpsRequest['recordType!{63733d83-c1fa-4244-bcca-b0ddcccccbf4}DS_TPS.fields.{1b3a0669-e51a-4b77-aa57-7002d19e9610}hardwareClass'], refreshAfter: "UNFOCUS", readOnly: true, validations: {} ) ), a!sideBySideItem( item: a!integerField( label: "Drawing Number(s)", labelPosition: "ABOVE", helpTooltip: "Relevant drawings and drawing numbers.", value: ri!tpsRequest['recordType!{63733d83-c1fa-4244-bcca-b0ddcccccbf4}DS_TPS.fields.{feb1c8f3-a2ee-4f7c-a7c3-7949054fc87b}drawingNumber'], saveInto:ri!tpsRequest['recordType!{63733d83-c1fa-4244-bcca-b0ddcccccbf4}DS_TPS.fields.{feb1c8f3-a2ee-4f7c-a7c3-7949054fc87b}drawingNumber'], refreshAfter: "UNFOCUS", required: true, readOnly: true, validations: {} ), width: "AUTO" ) }, alignVertical: "MIDDLE", spacing: "STANDARD" ), a!sideBySideLayout( items: { a!sideBySideItem( item: a!integerField( label: "Purchase Order", labelPosition: "ABOVE", helpTooltip: "Purchase Order or AxCES PR.", value: ri!tpsRequest['recordType!{63733d83-c1fa-4244-bcca-b0ddcccccbf4}DS_TPS.fields.{17ff2ac8-2b96-4d83-b1b8-01f576051b86}purchaseOrder'], saveInto: ri!tpsRequest['recordType!{63733d83-c1fa-4244-bcca-b0ddcccccbf4}DS_TPS.fields.{17ff2ac8-2b96-4d83-b1b8-01f576051b86}purchaseOrder'], refreshAfter: "UNFOCUS", required: true, readOnly: true, validations: {} ) ), a!sideBySideItem( item: a!integerField( label: "Serial Number(s)", labelPosition: "ABOVE", helpTooltip: "Assigned Serial Number(s) (if applicable).", value: ri!tpsRequest['recordType!{63733d83-c1fa-4244-bcca-b0ddcccccbf4}DS_TPS.fields.{40328bdb-c666-431b-9522-7db086f73f07}serialNumber'], saveInto: ri!tpsRequest['recordType!{63733d83-c1fa-4244-bcca-b0ddcccccbf4}DS_TPS.fields.{40328bdb-c666-431b-9522-7db086f73f07}serialNumber'], refreshAfter: "UNFOCUS", required: true, readOnly: true, validations: {} ) ), a!sideBySideItem( item: a!integerField( label: "Lot Number(s)", labelPosition: "ABOVE", helpTooltip: "Assigned Lot Number(s) (if applicable).", value: ri!tpsRequest['recordType!{63733d83-c1fa-4244-bcca-b0ddcccccbf4}DS_TPS.fields.{50f449bd-2d08-4501-87da-12876552066b}lotNum'], saveInto: ri!tpsRequest['recordType!{63733d83-c1fa-4244-bcca-b0ddcccccbf4}DS_TPS.fields.{50f449bd-2d08-4501-87da-12876552066b}lotNum'], refreshAfter: "UNFOCUS", required: true, readOnly: true, validations: {} ) ) }, spacing: "STANDARD" ), a!sideBySideLayout( items: { a!sideBySideItem( item: a!textField( label: "Request Title", labelPosition: "ABOVE", helpTooltip: "Title of the TPS request.", value: ri!tpsRequest['recordType!{63733d83-c1fa-4244-bcca-b0ddcccccbf4}DS_TPS.fields.{6187884e-4bd3-4f29-95d1-c2c9e1c90ea5}TPSTitle'], saveInto: ri!tpsRequest['recordType!{63733d83-c1fa-4244-bcca-b0ddcccccbf4}DS_TPS.fields.{6187884e-4bd3-4f29-95d1-c2c9e1c90ea5}TPSTitle'], refreshAfter: "UNFOCUS", required: true, readOnly: true, validations: {}, align: "LEFT" ), width: "AUTO" ), a!sideBySideItem( item: a!textField( label: "Parts Location", labelPosition: "ABOVE", helpTooltip: "Current building and lab location of the parts.", value: ri!tpsRequest['recordType!{63733d83-c1fa-4244-bcca-b0ddcccccbf4}DS_TPS.fields.{c6ba2c33-e732-41a9-8363-f602febddab1}partsLocation'], saveInto: ri!tpsRequest['recordType!{63733d83-c1fa-4244-bcca-b0ddcccccbf4}DS_TPS.fields.{c6ba2c33-e732-41a9-8363-f602febddab1}partsLocation'], refreshAfter: "UNFOCUS", required: true, readOnly: true, validations: {} ) ), a!sideBySideItem( item: a!integerField( label: "Parts Quantity", labelPosition: "ABOVE", helpTooltip: "Bill of Materials and Quantity of items/parts.", value:ri!tpsRequest['recordType!{63733d83-c1fa-4244-bcca-b0ddcccccbf4}DS_TPS.fields.{a50bd1c2-853e-4978-8fc0-669280707b77}quantity'], saveInto: ri!tpsRequest['recordType!{63733d83-c1fa-4244-bcca-b0ddcccccbf4}DS_TPS.fields.{a50bd1c2-853e-4978-8fc0-669280707b77}quantity'], refreshAfter: "UNFOCUS", required: true, readOnly: true, validations: {} ) ) }, alignVertical: "MIDDLE", spacing: "STANDARD" ), a!sideBySideLayout( items: { a!sideBySideItem( item: a!paragraphField( label: "Task Outline", labelPosition: "ABOVE", value: ri!tpsRequest['recordType!{63733d83-c1fa-4244-bcca-b0ddcccccbf4}DS_TPS.fields.{9b6b98e7-ecce-4faf-8718-b3036ebcff8b}taskOutline'], saveInto: ri!tpsRequest['recordType!{63733d83-c1fa-4244-bcca-b0ddcccccbf4}DS_TPS.fields.{9b6b98e7-ecce-4faf-8718-b3036ebcff8b}taskOutline'], refreshAfter: "UNFOCUS", height: "SHORT", required: true, readOnly: true, validations: {} ), width: "" ), a!sideBySideItem( item: a!paragraphField( label: "Additional Comments", labelPosition: "ABOVE", value: ri!tpsRequest['recordType!{63733d83-c1fa-4244-bcca-b0ddcccccbf4}DS_TPS.fields.{0c30750a-4d38-477f-81b4-43401237ada2}comments'], saveInto: ri!tpsRequest['recordType!{63733d83-c1fa-4244-bcca-b0ddcccccbf4}DS_TPS.fields.{0c30750a-4d38-477f-81b4-43401237ada2}comments'], refreshAfter: "UNFOCUS", height: "SHORT", required: true, readOnly: true, validations: {} ), width: "2X" ) } ) }, width: "AUTO" ) } ) }, /*showWhen: a!isNotNullOrEmpty(ri!tpsRequest),*/ isCollapsible: true, marginBelow: "MORE" ) ), rule!ASK_SCT_Comment( requestId: ri!request['recordType!{2ae53002-5d92-42a2-9e49-f4da57bb5aa7}ASK Request.fields.{ed63ad73-08ba-4d6b-9c2f-1ce50a57539d}requestId'], readOnly: or( a!isUserMemberOfGroup(username: loggedInUser(), groups: cons!ASK_GRP_VIEWERS), ri!request['recordType!{2ae53002-5d92-42a2-9e49-f4da57bb5aa7}ASK Request.fields.{97a60319-ec9d-4e4f-b592-9494bc39d14e}statusId'] = cons!ASK_REQUEST_STATUS_COMPLETE ) ) }
This is what the interface looks like when the values are populated:
Discussion posts and replies are publicly visible
Did you try to use the index() or property() functions? These allow you to provide a default value in case the lookup fails.
When I use the index()'s default value it gives me this error:
That's because you only provided the keyword "default" in index function, either provide for each of them or none.
How should I format it? I looked at the documentation and followed that but still confused
The documentation has plenty examples:
docs.appian.com/.../fnc_array_index.html