Skip to main content
July 27, 2022
Solved

Retrieve every data from database without one field using rule

  • July 27, 2022
  • 7 replies
  • 0 views

 Expression Rule:

cast('type!{urn:com:appian:types:HSM}HSM_Elements?list',
a!queryEntity(
entity: cons!HSM_Entity,
query: a!query(
pagingInfo: a!pagingInfo(
startIndex: 1,
batchSize: 5000,
sort: a!sortInfo(
field:"S_No",
ascending: true,
)
)
)
).data
)

I want to retrieve every data without Status field from database.

Is it possible to retrieve using rules?

    Best answer by harshitb6843

    You can use the 'selection' parameter in the a!query() to pass all the other field names except status. 

    7 replies

    harshitb6843
    July 27, 2022

    You can use the 'selection' parameter in the a!query() to pass all the other field names except status. 

    July 27, 2022

    I have added 'selection' paramater in the a!query. And also passed all fields excep status.

    But it shows an error like in above template.

    My Updated Code:

    cast('type!{urn:com:appian:types:HSM}HSM_Elements?list',
    a!queryEntity(
    entity: cons!HSM_Entity,
    query: a!query(
    selection:a!querySelection(
    Columns: a!queryColumn(
    field:{"S_No","Employee_Name","Employee_Id","Employee_Email_Id","Query","Comments","Date"},
    )
    ),
    pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: 5000,
    sort: a!sortInfo(
    field:"S_No",
    ascending: true,
    )
    )
    )
    ).data
    )

    harshitb6843
    July 27, 2022

    A queryColumn can only have one column name. And hence you will have to add multiple query columns. 
    Check the code below..

    cast('type!{urn:com:appian:types:HSM}HSM_Elements?list',
      a!queryEntity(
        entity: cons!HSM_Entity,
        query: a!query(
          selection:a!querySelection(
            columns: {
              a!queryColumn(
                field:"S_No",
              ),
              a!queryColumn(
                field:"Employee_Name",
              ),
              a!queryColumn(
                field:"Employee_Id",
              )
            }
          ),
          pagingInfo: a!pagingInfo(
            startIndex: 1,
            batchSize: 5000,
            sort: a!sortInfo(
              field:"S_No",
              ascending: true,
            )
          )
        )
      ).data
    )

    July 27, 2022

    You have to use selection concept for it. queryselection()

    adityag9712
    July 27, 2022

    You can use the 'selection' parameter in the a!query() to pass all the other field names except status.