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
10 replies
Subscribers
9 subscribers
Views
5807 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
General
Hi, I have been working on CDT null checks. My CDT has two attributes
iainf
over 12 years ago
Hi,
I have been working on CDT null checks. My CDT has two attributes: ID and email (one to many).
I query the table on the ID. I then do an isNull check.
Sometimes I get "true" because the query returns this sort of object: ("").
Sometimes it simply fails because the query returns this sort of object: (ID = "", Email = "").
Can anyone tell me when I can expect to see this: (""), and when I can expect to see this: (ID = "", Email = "").
This is important because in testing I found the rule was working and after deployment it was not.
I know that the correct thing to do is to do the isNull check on the primary attribute of the CDT; what I'm after here is an explanation of the apparantly unpredictable behaviour.
Thanks
Iain...
OriginalPostID-63485
OriginalPostID-63485
Discussion posts and replies are publicly visible
0
revat.anandsongkit
Appian Employee
over 12 years ago
- When you sett the value of the CDT to null i.e. in a system task, you create a custom output with the following expression ="" and set it to equal your CDT
(ID="", Email="") - When you call a query rule with has no results
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
shelzle
over 12 years ago
When you create an expression which combines several checks like isNull(ri!CDT) and isNull(ri!CDT.ID), len(ri!CDT.ID) > 0 and so on. This is the way I go in that cases.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Shaun Kilby
Appian Employee
over 12 years ago
I agree with Stefan, please make sure you use a unique name for your expression though. (i.e. PRFX_isBlank)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
iainf
over 12 years ago
Thanks for these solutions. Any ideas when the query rule, when finding nothing, will give me [No result] (a single variable handled by isNull) vs. [ID = "", Email = ""] which won't be handled by isNull?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
revat.anandsongkit
Appian Employee
over 12 years ago
You should be able to handle [ID="", Email=""] using the length() function. So in your rule, check for isNull first then length and if the result is [ID="", Email=""], length=0.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
revat.anandsongkit
Appian Employee
over 12 years ago
Note that if the process variable is a scalar, a query rule which yields an empty result will produce [ID="", Email=""]. However, if the process variable you are saving the query rule to is of type multiple, an empty result will produce an empty list i.e. "".
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
revat.anandsongkit
Appian Employee
over 12 years ago
*Correction on my previous post. length([ID="", Email=""]) = 1
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
iainf
over 12 years ago
Thanks very much for these answers. Revat, do you mean that 'internal workings' of the query rule are determined by where the result of the query rule is destined? So, if my query rule will end up in a non-multiple variable, then any isNull functions it contains, when applied to a CDT row, will, when empty, return [ID="", Email=""]; while if it will end up in a multiple variable, then one gets ""?
Thanks if you can clarify at all for me!
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
revat.anandsongkit
Appian Employee
over 12 years ago
If calling a query rule which produces an empty result -
Non-multiple: [ID="", Email=""]. If you do an isNull check on this, it will return False and length = 1. What you could check is if a specific field is null e.g. isnull(pv!cdt.ID)
Multiple: pv! = empty list. isnull(pv!) = False but length(pv!) = 0.
What I would suggest is to create a simple model that runs through both of these use cases...I think it will help a lot if you see it for yourself. Also, have a look at these two links:
forum.appian.com/.../Informational_Functions
and
forum.appian.com/.../Array_Functions
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
iainf
over 12 years ago
Thanks very much for your help on this, I will set up some PMs to test these scenarios as you suggest.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel