Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
5 replies
Subscribers
8 subscribers
Views
3594 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
Hi All, I have created a query Entity that fetches data from a view.
rishub356
over 9 years ago
Hi All,
I have created a query Entity that fetches data from a view. I am facing issue when the query entity has blank inputs & it tries to fetch all the values. How can I make sure to return no values when the input is null. Below s the query entity code:
= a!queryEntity(
entity: cons!LISTING,
query: a!query(
logicalExpression: if(
and(
rule!APN_isBlank(
ri!Num
),
rule!APN_isBlank(
ri!secondID
),
rule!APN_isBlank(
ri!Code
),
rule!APN_isBlank(
ri!D
)
),
null,
a!queryLogicalExpression(
operator: "AND",
filters: {
if(
rule!APN_isBlank(
ri!Num
),
{},
a!queryFilter(
field: "Num",
operator: "=",
value: ri!Num
)
),
if(
rule!APN_isBlank(...
OriginalPostID-208504
OriginalPostID-208504
Discussion posts and replies are publicly visible
Parents
0
jagadeesh
Certified Lead Developer
over 9 years ago
you can put if condition before applying filter
just like
a!queryEntity(
entity: cons!COB_DATASTORE_CUSTOMER_CASE,
query: a!query(
selection: if(
rule!COB_verifyIsNullorEmpty(
ri!selectionColumns
),
{},
a!querySelection(
columns: apply(
rule!COB_dynamicQueryColumn,
{
ri!selectionColumns
}
)
)
),
pagingInfo: if(
isnull(
ri!pagingInfo
),
a!pagingInfo(
startIndex: 1,
batchSize: - 1
),
ri!pagingInfo
),
logicalExpression: if(
and(
rule!COB_verifyIsNullorEmpty(
ri!Id
),
rule!COB_verifyIsNullorEmpty(
ri!Name
),
rule!COB_verifyIsNullorEmpty(
ri!customerId
),
rule!COB_verifyIsNullorEmpty(
ri!caseStatus
)
),
null,
a!queryLogicalExpression(
operator: "AND",
filters: {
if(
rule!COB_verifyIsNullorEmpty(
ri!Id
),
{},
a!queryFilter(
field: "Id",
operator: "=",
value: ri!Id
)
),
if(
rule!COB_verifyIsNullorEmpty(
ri!Name
),
{},
a!queryFilter(
field: "Name",
operator: "includes",
value: ri!Name
)
),
if(
rule!COB_verifyIsNullorEmpty(
ri!customerId
),
{},
a!queryFilter(
field: "CustomerId",
operator: "=",
value: ri!customerId
)
),
if(
rule!COB_verifyIsNullorEmpty(
ri!caseStatus
),
{},
a!queryFilter(
field: "CaseStatus",
operator: "=",
value: ri!caseStatus
)
)
}
)
)
)
).data
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Reply
0
jagadeesh
Certified Lead Developer
over 9 years ago
you can put if condition before applying filter
just like
a!queryEntity(
entity: cons!COB_DATASTORE_CUSTOMER_CASE,
query: a!query(
selection: if(
rule!COB_verifyIsNullorEmpty(
ri!selectionColumns
),
{},
a!querySelection(
columns: apply(
rule!COB_dynamicQueryColumn,
{
ri!selectionColumns
}
)
)
),
pagingInfo: if(
isnull(
ri!pagingInfo
),
a!pagingInfo(
startIndex: 1,
batchSize: - 1
),
ri!pagingInfo
),
logicalExpression: if(
and(
rule!COB_verifyIsNullorEmpty(
ri!Id
),
rule!COB_verifyIsNullorEmpty(
ri!Name
),
rule!COB_verifyIsNullorEmpty(
ri!customerId
),
rule!COB_verifyIsNullorEmpty(
ri!caseStatus
)
),
null,
a!queryLogicalExpression(
operator: "AND",
filters: {
if(
rule!COB_verifyIsNullorEmpty(
ri!Id
),
{},
a!queryFilter(
field: "Id",
operator: "=",
value: ri!Id
)
),
if(
rule!COB_verifyIsNullorEmpty(
ri!Name
),
{},
a!queryFilter(
field: "Name",
operator: "includes",
value: ri!Name
)
),
if(
rule!COB_verifyIsNullorEmpty(
ri!customerId
),
{},
a!queryFilter(
field: "CustomerId",
operator: "=",
value: ri!customerId
)
),
if(
rule!COB_verifyIsNullorEmpty(
ri!caseStatus
),
{},
a!queryFilter(
field: "CaseStatus",
operator: "=",
value: ri!caseStatus
)
)
}
)
)
)
).data
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data