Created an interface rule (see code attached) that displays information via a series of query rules (require a date or datetime value) and a default date value that can be changed by the user. The interface rule works great, but when I associate it with a Report, I get this error.
Error Evaluating UI Expression Expression evaluation error at function rule!psh_disapprovedDashboard: Rule 'psh_disapproveddashboard' has 1 parameters, but instead passed 0 parameters.
I'm assuming it's because it's looking for the user input for 'ri!year_int'. I specifically set a default value for this parameter in the interface rule so data would display regardless of whether or not the user changes the year. Why won't this work when I associate the rule with a 'Report' object? Do I have to make it a
=load( ri!year_int: if(isnull(ri!year_int), year(now())-5, ri!year_int), local!noByItobProducts: rule!psh_getNoByItobProducts(datetime(ri!year_int, month(now()), day(now()), 0, 0, 0)), local!noByItobProductsPagingInfo: a!pagingInfo(startIndex: 1, batchSize: 25, sort: a!sortInfo(field:"name", ascending: true)), local!noRenewAgreements: rule!psh_getNoRenewalAgreements(date(ri!year_int, month(now()), day(now()))), local!noRenewalPagingInfo: a!pagingInfo(startIndex: 1, batchSize: 25, sort: a!sortInfo(field: "agreementDescription", ascending: true)), with( local!noByItobProductDataSubset: todatasubset(local!noByItobProducts, local!noByItobProductsPagingInfo), local!noRenewalDataSubset: todatasubset(local!noRenewAgreements, local!noRenewalPagingInfo), a!formLayout( label: "Disapproved Purchase Requests and Agreement Renewals", instructions: "Update Year Shown to Display Additional Items", contents: { a!sectionLayout( label: "", contents:{ a!textField( label: "Disapproved Later Than:", labelPosition: "ADJACENT", value: ri!year_int, /*value: if(isnull(ri!year_int), year(now())-5, ri!year_int),*/ saveInto: ri!year_int, refreshAfter: "KEYPRESS" ) } ), a!sectionLayout( label: "New Purchases Disapproved By ITOB", contents: { a!gridField( labelPosition: "ABOVE", totalCount: local!noByItobProductDataSubset.totalCount, columns: { a!gridTextColumn( label: "Product", field: "name", data: index(local!noByItobProductDataSubset.data, "name", null)), a!gridTextColumn( label: "Decided By", data: index(local!noByItobProductDataSubset.data, "decidedBy", null)), a!gridTextColumn( label: "ITOB Decision Date", data: index(local!noByItobProductDataSubset.data, "itobDateTime", null)), a!gridTextColumn( label: "Disapproval Reason", data: index(local!noByItobProductDataSubset.data, "itobFeedback", null)) }, value: local!noByItobProductsPagingInfo, saveInto: { a!save( local!noByItobProductsPagingInfo, if( isnull( save!value.sort ), local!noByItobProductsPagingInfo, if( length( save!value.sort.field ) <= 0, local!noByItobProductsPagingInfo, a!pagingInfo( startIndex: save!value.startIndex, batchSize: save!value.batchSize, sort: a!sortInfo( field: save!value.sort.field, ascending: save!value.sort.ascending ) ) ) ) ) } ) } ), a!sectionLayout( label: "Agreements Not Renewed", contents: { a!gridField( labelPosition: "ABOVE", totalCount: local!noRenewalDataSubset.totalCount, columns: { a!gridTextColumn( label: "Product", field:"agreementDescription", data: index(local!noRenewalDataSubset.data, "agreementDescription", null) ), a!gridTextColumn( label: "Submitted By", data: index(local!noRenewalDataSubset.data, "submittedBy", null) ), a!gridTextColumn( label: "Current Expiration Date", data: index(local!noRenewalDataSubset.data, "expiredDate", null) ) }, value: local!noRenewalPagingInfo, saveInto: { a!save( local!noRenewalPagingInfo, if( isnull( save!value.sort ), local!noRenewalPagingInfo, if( length( save!value.sort.field ) <= 0, local!noRenewalPagingInfo, a!pagingInfo( startIndex: save!value.startIndex, batchSize: save!value.batchSize, sort: a!sortInfo( field: save!value.sort.field, ascending: save!value.sort.ascending ) ) ) ) ) } ) } ) } ) ) )
Discussion posts and replies are publicly visible
Reports do not pass in rule inputs, which is why your interface is breaking: "Rule ... has 1 parameters, but instead [the report context] passed 0 parameters". You can refactor your interface by removing the rule input, adding a new local variable at the top of your load, and setting this new load variable with a default value. Ex.
=load( local!year_int: year(now())-5, local!noByItobProducts: rule!psh_getNoByItobProducts(datetime(local!year_int, month(now()), day(now()), 0, 0, 0)), local!noByItobProductsPagingInfo: a!pagingInfo(startIndex: 1, batchSize: 25, sort: a!sortInfo(field:"name", ascending: true)), local!noRenewAgreements: rule!psh_getNoRenewalAgreements(date(local!year_int, month(now()), day(now()))), local!noRenewalPagingInfo: a!pagingInfo(startIndex: 1, batchSize: 25, sort: a!sortInfo(field: "agreementDescription", ascending: true)), with( local!noByItobProductDataSubset: todatasubset(local!noByItobProducts, local!noByItobProductsPagingInfo), local!noRenewalDataSubset: todatasubset(local!noRenewAgreements, local!noRenewalPagingInfo), a!formLayout( label: "Disapproved Purchase Requests and Agreement Renewals", instructions: "Update Year Shown to Display Additional Items", contents: { a!sectionLayout( label: "", contents:{ a!textField( label: "Disapproved Later Than:", labelPosition: "ADJACENT", value: local!year_int, /*value: if(isnull(local!year_int), year(now())-5, local!year_int),*/ saveInto: local!year_int, refreshAfter: "KEYPRESS" ) } ), a!sectionLayout( label: "New Purchases Disapproved By ITOB", contents: { a!gridField( labelPosition: "ABOVE", totalCount: local!noByItobProductDataSubset.totalCount, columns: { a!gridTextColumn( label: "Product", field: "name", data: index(local!noByItobProductDataSubset.data, "name", null)), a!gridTextColumn( label: "Decided By", data: index(local!noByItobProductDataSubset.data, "decidedBy", null)), a!gridTextColumn( label: "ITOB Decision Date", data: index(local!noByItobProductDataSubset.data, "itobDateTime", null)), a!gridTextColumn( label: "Disapproval Reason", data: index(local!noByItobProductDataSubset.data, "itobFeedback", null)) }, value: local!noByItobProductsPagingInfo, saveInto: { a!save( local!noByItobProductsPagingInfo, if( isnull( save!value.sort ), local!noByItobProductsPagingInfo, if( length( save!value.sort.field ) <= 0, local!noByItobProductsPagingInfo, a!pagingInfo( startIndex: save!value.startIndex, batchSize: save!value.batchSize, sort: a!sortInfo( field: save!value.sort.field, ascending: save!value.sort.ascending ) ) ) ) ) } ) } ), a!sectionLayout( label: "Agreements Not Renewed", contents: { a!gridField( labelPosition: "ABOVE", totalCount: local!noRenewalDataSubset.totalCount, columns: { a!gridTextColumn( label: "Product", field:"agreementDescription", data: index(local!noRenewalDataSubset.data, "agreementDescription", null) ), a!gridTextColumn( label: "Submitted By", data: index(local!noRenewalDataSubset.data, "submittedBy", null) ), a!gridTextColumn( label: "Current Expiration Date", data: index(local!noRenewalDataSubset.data, "expiredDate", null) ) }, value: local!noRenewalPagingInfo, saveInto: { a!save( local!noRenewalPagingInfo, if( isnull( save!value.sort ), local!noRenewalPagingInfo, if( length( save!value.sort.field ) <= 0, local!noRenewalPagingInfo, a!pagingInfo( startIndex: save!value.startIndex, batchSize: save!value.batchSize, sort: a!sortInfo( field: save!value.sort.field, ascending: save!value.sort.ascending ) ) ) ) ) } ) } ) } ) ) )