I am using getdatasubsetdownloadlinkfromrule and following the steps in document

I am using getdatasubsetdownloadlinkfromrule and following the steps in documentation.
forum.appian.com/.../Download_DataSubset_Plugin.html

When I complete selecting the filter, URL is getting generated but when I click on the link, 500 - Internal Server Error is showing up. We tried several solution provided in other post but nothing worked. We were forced to move the report to a process model using a different plugin. Attaching the code snippet here. Appreciate any help.

Report_HomeScreen.txt

OriginalPostID-164135

OriginalPostID-164135

  Discussion posts and replies are publicly visible

  • Hi Kumaravel,
    If there are multiple filters,you have to use a!fromJson & a!Json functions. Please find the modified code.

    Report_getExportableDataSubset_updated.txt

    Report_HomeScreen_updated.txt

  • Thanks chandhinir. Your suggestion worked.

    And I made one more change. Since it was mentioned in the other post, the data subset has to be created by calling a rule one more time inside the rule (even if we have the datasubset obtained in parent rule) where we are constructing ExportableDataSubset object, I was passing three parameters (fromdate, todate and paginginfo) inside the rule. Now found that its not required. So I am just passing my pre-fetched data subset from parent rule as JSON and converting back into appian type and mapping it in ExportableDataSubset parameter.

    So the modification i made on top of chandhinir's response is

    Rule: Report_HomeScreen

    getdatasubsetdownloadlinkfromrule(
    rule!Report_getExportableDataSubset,
    a!toJson(
    {
    datasubset_any: local!datasubset,
               }
    )
    )

    Rule: Report_getExportableDataSubset

    with(
    local!search: a!fromJson(
    ri!input
    ), /*-- ri!input of type text) -- */
    'type!{urn:appian:plugin:datasubsetdownload:types}ExportableDataSubset'
    (
    datasubset: local!search.datasubset_any,
    fieldNames: {"requestStatus","requestId","ageOfStatus"},
    fieldLabels: {"STATUS OF CDD","COUNT","AGING IN DAYS"},
    filename: "AgingReport"
    )
    )

    Please let me know if anyone face any issue in this approach
  • Hi, I'm currently facing the same issue. Everything goes well until using getdatasubsetdownloadlinkfromrule. My rule, very similar to your Report_getExportableDataSubset, returns the correct exportable data subset when isolated. But when when calling it like this:

    local!exportUri: getdatasubsetdownloadlinkfromrule(
    rule: rule!CTQG_ToExportableDataSubset,
    input: a!toJson(
    {
    datasubset: local!exportDatasubset,
    fieldNames: cons!FIELDNAMES_FOREXPORT,
    fieldLabels: cons!FIELDLABELS_FOREXPORT,
    filename: rule!FILENAME_FOREXPORT()
    }
    )
    )

    It always returns null and leads to the Error 500 issue.

    I would appreciate some insight if you have any.

    Thanks
  • I should mention that there's 60 columns to be exported. I don't know if it's limited or not.
  • Try without keywords in parameters. Like below:

    local!exportUri: getdatasubsetdownloadlinkfromrule(
    rule!CTQG_ToExportableDataSubset,
    a!toJson(
    {
    datasubset: local!exportDatasubset,
    fieldNames: cons!FIELDNAMES_FOREXPORT,
    fieldLabels: cons!FIELDLABELS_FOREXPORT,
    filename: rule!FILENAME_FOREXPORT()
    }
    )
    )


    One more suggestion. Pass only the first parameter (exportDataSubset). For remaining parameters you are already passing them from constants. So instead of passing them from parent rule, you can directly give them in child rule. But this is not related to your issue.
  • Hi kumaravein. I gave it a shot and it seemed hopeful but still ended in the 500 error. The logs are accusing me of passing no parameter, which is nonsense. So I'm going to check out the src and narrow down what's going on. I suspect it doens't like one or some of the fields being passed. Thanks for your help, and I'll report back if I figure it out.
  • There is always a chance of human error :) So try patiently and attach your files here if not successful.
  • I forgot to report back, but I've figured out my issue.

    a!toJson and a!fromJson cause issues when sending through a large datasubset. It seems to have a character limit, because I could send a varying amount of data through, but once it hit the limit (unsure of exact character limit) it would not convert back to a datasubset and it would cause the getdatasubsetdownloadlinkfromrule to break.

    What I am doing now is passing just the search criteria in, and then using that to bring back the datasubset at the CTQG_ToExportableDataSubset level instead of passing the datasubset into it.

    This means I could not make the exportable data subset rule generic. It's a shame but hopefully this knowledge helps others.

    Thanks for your suggestions kumaravein
  • Thanks for sharing your solution Jerome. That will help a lot as we are passing the data subset as JSON now and in future it may create issue if the volume of data increases. From your experience, It looks better to pass the search criteria and form the data subset inside the child although the rule cannot be made generic which will a minor concern,