I am using the Download datasubset plugin for generating download link of Excel

I am using the Download datasubset plugin for generating download link of Excel file from a Tempo Report.
I have created the rule which returns an ExportableDataSubset.

I get the error: Expression evaluation error at function 'getdatasubsetdownloadlinkfromrule' [line 20]: Error evaluating function 'getdatasubsetdownloadlinkfromrule' : 0.

I have ensured that the rule which returns Exportable Data Subset returns it correctly. Also went through the sample Application which demonstrates its usage. But I am not able to figure out the issue. For reference, I have attached the SAIL code in a text file to this post.

If anyone has used this plugin before, please check my code and let me know if I am doing it incorrectly. Please note that ri!input is of type Number(Integer). I have set it to Numeric Type as per the Sample Application given for the plugin

Issue_DownloadDataSubsetPlugin.txt

OriginalPostID-170148

OriginalPostID-170148

  Discussion posts and replies are publicly visible

  • @chetany No problem, I would like to suggest you to reproduce the problem first. If you are successful in reproducing the problem(I hope you will because I tried the same example which you are trying), then I would like to suggest to try various rule (the one which gets you exportable datasubset) names such as 61LexportDataForExcelReports/ L_exportDataForExcelReports/ 61_exportDataForExcelReports etc. Then we can conclude the reason of the behavior and decide if the culprit is underscore or the letters before underscore or the numbers etc. I have seen some other posts in the forum that were discussing about 'Download Datasubset' plugin and their rule name is making use of underscore. Let's know if there are any findings from your side.
  • @chetany Hi, the actual issue related to name is, the plugin is failing to search or parse the rule, when the rule's name starts with a number and that's what my findings conclude. So you could go ahead with including underscores, but please make a note that your rule doesn't start with a number(s). It's okay even if you have number(s) in the middle.

    Here are the technical details related to this feed entry with regards to problem in name of rule that is used to get exportable data subset in fn!getdatasubsetdownloadlinkfromrule():

    Line #53 in GetDataSubsetDownloadLinkFromRule.java is throwing an array index out of bounds exception

    Content asContent = cs.searchByRoot(baseId, ruleName, new ContentFilter(ContentConstants.TYPE_NON_DOCUMENT))[0];

    The API function 'searchByRoot' in ContentService interface accepts the rule name (after making a conversion on it) passed by us as a parameter and a regex of type text is the type of input. Not sure if this is failing to accept the text that starts with number.

    Logs:

    [http-/0.0.0.0:8080-8] ERROR com.appiancorp.rest.shared.AppianExceptionMapper - Internal Server Error on REST API invocation.
    com.appiancorp.process.expression.ExpressionRuntimeException$AppianExceptionProvider: Expression evaluation error in rule 'test_report' at function fn!getdatasubsetdownloadlinkfromrule [line 3]: Error evaluating function fn!getdatasubsetdownloadlinkfromrule : 0 (APNX-1-4198-000)
    \tat com.appiancorp.process.expression.ExpressionRuntimeException.(ExpressionRuntimeException.java:70)

    Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
    \tat com.appiancorp.ps.plugins.downloaddatasubsetfromrule.GetDataSubsetDownloadLinkFromRule.getDataSubsetDownloadLinkFromRule(GetDataSubsetDownloadLinkFromRule.java:53)

    Hope the above helps those who faces similar issue or tend to look at the plugin code to solve if it is an issue really.
  • Thank you Sikhi. My guess is that the error is consistent with Java's variable naming rules. Variables in Java cannot start with a number but they are allowed at other positions in the name. Since the plugins are developed in Java, I think this might be the fundamental issue. This is just my guess- I could be wrong. One will need to dig deeper into the exception stacktrace to find the exact reason.
  • @chetany Hmm might be, anyhow it's good that we came to a conclusion from the usage perspective and rest lies with the ones who intend to modify the plugin.
  • Hi All,

    I am getting the same error but my rule name does not start with a number.

    I am getting error:Expression evaluation error at function fn!getdatasubsetdownloadlinkfromrule [line 30]: Error evaluating function fn!getdatasubsetdownloadlinkfromrule : 0

    I am using the function to export data to excel:

    fn!getdatasubsetdownloadlinkfromrule(rule: rule!GetExportableDataSubset, input: toString(local!choice)))

    The rule!GetExportableDataSubset has 1 parameter called input of type text and it returns ExportableDataSubset.

    Thanks in advance.