I get the firstname and lastname in a single row, whereas the outcome should be one value per row

Hello ,

I am trying to create a report, with a document download link using: getdatasubsetdownloadlinkfromrule,
I am able to display the data in excel sheet, there are 1 cdt, which has 4 fields, app,group, firstname and lastname, out of which firstname and lastname are of multiple type.
The problem is I get the firstname and lastname in a single row, whereas the outcome should be one value per row, I have verified the length of that cdt.firstname, it returns the exact number of lenght, but in excel it is showing as a row
Let meknow what am i missing, below is the code snippet:

In main rule:

local!linkdata: todatasubset(local!cdt, local!pagingInfo1),
                    local!ruleURI: getdatasubsetdownloadlinkfromrule(rule: rule!GenerateExcelRule, input: tostring(a!toJson(local!linkdata))),

In subrule:
=with(
local!search: a!fromJson(ri!input),
'type!{urn:appian:plugin:datasubsetdownload:types}ExportableDataSubset'(
filename: "Exported Data",
fiel...

OriginalPostID-142594

OriginalPostID-142594

  Discussion posts and replies are publicly visible

  • ...dNames: {
               "app",
    "group",
    "firstname",
    "lastname"
    },
    fieldLabels: {
               "app",
    "Group",
    "FirstName",
    "LastName"
    },
    datasubset: local!search          )
    )

  • Hi,
    You have to recreate datasubset in inner rule. As you are sending array to the Json by this the array is converting into single string.
    Here input variable should be used for passing variables that are used for filtering the data. You cannot send datasubset in this input variable.
  • Hello I have tried recreating the datasubset in inner rule, but still for firstname and last name it is displaying result in a single row, The code snipped is:
    local!ruleURI: getdatasubsetdownloadlinkfromrule(rule: rule!GenerateExcelRule, input: a!toJson(
                        {
                        app: ri!app,
                        group: ri!group,
                        firstname: local!cdt.firstname,
                        lastname: local!cdt.lastname
                        }))

    inner rule:

    =with(
    local!pagingInfo1: a!pagingInfo(startIndex: 1, batchSize: -1),
    local!search: a!fromJson(ri!input),
    local!newData: rule!generatecdt(local!search.app, local!search.group, local!search.firstname, local!search.lastname),
    local!DataSubset: todatasubset(
    local!newData,
    local!pagingInfo1
    ),
    'type!{urn:appian:plugin:datasubsetdownload:types}ExportableDataSubset'(
    filename: "Exported Data",
    fieldNames: {
               "app",
    "group",
    "firstname",
    "lastname"
    },
    fieldLabels: {
               "app",
    "Group",
    "FirstName",
    "LastName"
    },
    datasubset: local!DataSubset          )
    )

    what couldbe the issue
  • with(
    local!newData: type!aatest(
    app: ri!app,
    group: ri!group,
    firstname: ri!firstname,
    lastname: ri!lastname
    ),
    local!newData
    )


    where app text single
    group text single
    firstname text multiple
    lastname text multiple
  • Try this:

    local!ruleURI: getdatasubsetdownloadlinkfromrule(rule: rule!GenerateExcelRule, input: a!toJson(
                        {
                        app: ri!app,
                        group: ri!group,
                        firstname: joinarray(local!cdt.firstname,"|"),
                        lastname: joinarray(local!cdt.lastname,"|")
                        }))

    inner rule:

    =with(
    local!pagingInfo1: a!pagingInfo(startIndex: 1, batchSize: -1),
    local!search: a!fromJson(ri!input),
    local!newData: apply(
                                                                rule!generatecdt,
                                                                merge(
                                                                split(local!search.firstname,"|"),
                                                                split(local!search.lastname,"|")
                                                                ),
                                                                local!search.app,
                                                                local!search.group
                                                                ),
    local!DataSubset: todatasubset(
    local!newData,
    local!pagingInfo1
    ),
    'type!{urn:appian:plugin:datasubsetdownload:types}ExportableDataSubset'(
    filename: "Exported Data",
    fieldNames: {
                        "app",
    "group",
    "firstname",
    "lastname"
    },
    fieldLabels: {
                        "app",
    "Group",
    "FirstName",
    "LastName"
    },
    datasubset: local!DataSubset          )
    )



    Also in rule!generatecdt update sequence of inputs:

    firstname
    lastname
    apps
    groups