Is it possible to create dynamic columns when using a!querySelection on a!queryE

Is it possible to create dynamic columns when using a!querySelection on a!queryEntity? Perhaps using apply() to iterate over some list (say of length 3) to generate 3 columns with dynamic field names? If this is possible, could someone help me creating an expression rule with any list of size 2 or 3 to generate dynamic columns with dynamic field names? When I try the attach, I am getting the error: "Expression evaluation error : Syntax error. Details: Expression evaluation error at function a!querySelection parameter 1: Keyword and non-keyword arguments must not be mixed. Used in: apply.." Also, in the attached, I am not using dynamic names for the columns.

dynamicQueryEntityColumns.txt

OriginalPostID-191930

OriginalPostID-191930

  Discussion posts and replies are publicly visible

Parents
  • @erickp Hi, that's an expected issue. So if you closely observe the code snippet developed by you, you can see that you are passing few arguments by keyword and few without.

    apply(
    /* Here the 'function' parameter's value is provided with help of keyword. That is, you are saying to Appian that 'function' parameter will get some particular value. */
    function: a!queryColumn(
    field: _
    ),
    {"id", "gtBank"} /*Where as the 'list' parameter's value is provided without keyword. That is, here you haven't specified any keyword, and we can call this as argument by non-keyword or position. */
    )

    So in short, try to develop a code snippet by making use of arguments completely or by making use of non-keyword or by position approach. If you try to combine both of them, you will see an error 'Keyword and non-keyword arguments must not be mixed.' which you have experienced.

    Added to the above, you can follow the code snippet suggested by @sonalk, but still that will give you an error. Replace 'a!paginInfo' with a!pagingInfo.

    Re the question 'should I use a!applyComponents()' - To the best of my knowledge, until and unless you store local data (Editable Grid is a good example for this), that is preservation of state, you don't need the a!applyComponents(). You can go ahead with using apply() as of now.
Reply
  • @erickp Hi, that's an expected issue. So if you closely observe the code snippet developed by you, you can see that you are passing few arguments by keyword and few without.

    apply(
    /* Here the 'function' parameter's value is provided with help of keyword. That is, you are saying to Appian that 'function' parameter will get some particular value. */
    function: a!queryColumn(
    field: _
    ),
    {"id", "gtBank"} /*Where as the 'list' parameter's value is provided without keyword. That is, here you haven't specified any keyword, and we can call this as argument by non-keyword or position. */
    )

    So in short, try to develop a code snippet by making use of arguments completely or by making use of non-keyword or by position approach. If you try to combine both of them, you will see an error 'Keyword and non-keyword arguments must not be mixed.' which you have experienced.

    Added to the above, you can follow the code snippet suggested by @sonalk, but still that will give you an error. Replace 'a!paginInfo' with a!pagingInfo.

    Re the question 'should I use a!applyComponents()' - To the best of my knowledge, until and unless you store local data (Editable Grid is a good example for this), that is preservation of state, you don't need the a!applyComponents(). You can go ahead with using apply() as of now.
Children
No Data