I am trying to achieve a functionality where a user upload an excel then added a function to check the format of the excel file whether it matches with cdt or not. if matches, then user can proceed otherwise a hidden section layout will appear with a warning and download option for correct excel sample format but i am getting error in readexcelsheetpaging() as it shows null value error for document parameter.i try to fix it by using if condition and it solves the null error but now when i try to upload an excel file it shows other error "Interface Definition: Expression evaluation error at function 'readexcelsheetpaging' [line 2]: com.appiancorp.suiteapi.content.exceptions.InvalidContentException: Invalid Content ID".a!localVariables( local!excelFormatFromFile: readexcelsheetpaging( excelDocument: if( isnull(ri!excelFile), cons!SD_EXCELFILE, ri!excelFile ), sheetNumber: 0, paginginfo: a!pagingInfo(1, 1), numberOfColumns: 11 ).data.values[1], local!cdt: a!keys( value: 'type!{urn:com:appian:SD}SD_Student_Data'() ), local!excelFormatCheck: and( a!forEach( items: local!excelFormatFromFile, expression: { if( local!cdt[fv!index + 1] = local!excelFormatFromFile[fv!index], true, false ) } ) ), a!formLayout( label: "Excel File Upload", contents: { a!sectionLayout( contents: { a!fileUploadField( label: "File Upload", labelPosition: "ABOVE", target: cons!SD_CONSTANT_DOCUMENT, fileNames: "Excel File" & now(), maxSelections: 1, value: ri!excelFile, saveInto: ri!excelFile, validations: { a!localVariables( local!invalidExtensions: difference( upper(fv!files.extension), { "XLSX", "XLS" } ), if( length(local!invalidExtensions) > 0, "Invalid File Format.File format should be of xls or xlsx ", "" ) ), } ), a!sectionLayout( label: "Invalid excel file format.Refer to this document for excel sheet format", contents: { a!linkField( label: "", labelPosition: "ABOVE", links: { a!documentDownloadLink( document: cons!SD_EXCELFILE, label: "Download Sample Document" ) } ) }, showWhen: { local!excelFormatCheck = false } ) } ) }, buttons: a!buttonLayout( primaryButtons: { a!buttonWidget( label: "Submit", submit: true, style: "PRIMARY" ) }, secondaryButtons: { a!buttonWidget( label: "Cancel", value: true, saveInto: ri!cancel, submit: true, style: "NORMAL", validate: false ) } ) ), )
a!localVariables( local!excelFormatFromFile: readexcelsheetpaging( excelDocument: if( isnull(ri!excelFile), cons!SD_EXCELFILE, ri!excelFile ), sheetNumber: 0, paginginfo: a!pagingInfo(1, 1), numberOfColumns: 11 ).data.values[1], local!cdt: a!keys( value: 'type!{urn:com:appian:SD}SD_Student_Data'() ), local!excelFormatCheck: and( a!forEach( items: local!excelFormatFromFile, expression: { if( local!cdt[fv!index + 1] = local!excelFormatFromFile[fv!index], true, false ) } ) ), a!formLayout( label: "Excel File Upload", contents: { a!sectionLayout( contents: { a!fileUploadField( label: "File Upload", labelPosition: "ABOVE", target: cons!SD_CONSTANT_DOCUMENT, fileNames: "Excel File" & now(), maxSelections: 1, value: ri!excelFile, saveInto: ri!excelFile, validations: { a!localVariables( local!invalidExtensions: difference( upper(fv!files.extension), { "XLSX", "XLS" } ), if( length(local!invalidExtensions) > 0, "Invalid File Format.File format should be of xls or xlsx ", "" ) ), } ), a!sectionLayout( label: "Invalid excel file format.Refer to this document for excel sheet format", contents: { a!linkField( label: "", labelPosition: "ABOVE", links: { a!documentDownloadLink( document: cons!SD_EXCELFILE, label: "Download Sample Document" ) } ) }, showWhen: { local!excelFormatCheck = false } ) } ) }, buttons: a!buttonLayout( primaryButtons: { a!buttonWidget( label: "Submit", submit: true, style: "PRIMARY" ) }, secondaryButtons: { a!buttonWidget( label: "Cancel", value: true, saveInto: ri!cancel, submit: true, style: "NORMAL", validate: false ) } ) ), )
Discussion posts and replies are publicly visible