<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>I am having problems writing an expression rule that uses displayvalue() functio</title><link>https://community.appian.com/discussions/f/rules/6005/i-am-having-problems-writing-an-expression-rule-that-uses-displayvalue-functio</link><description>I am having problems writing an expression rule that uses displayvalue() function. I have an array CDT called BusinessRulesCDT. It keeps erroring out complaining about the 4th argument to displayvalue() which is the default value. At run time, it gives</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: I am having problems writing an expression rule that uses displayvalue() functio</title><link>https://community.appian.com/thread/23277?ContentTypeID=1</link><pubDate>Fri, 02 Oct 2015 19:00:26 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:919a6254-b999-47a9-8d27-02c8125410de</guid><dc:creator>briank538</dc:creator><description>Looks like I can only pass in a pv that is a CDT array itself.  If I have that CDT array defined as a field in another CDT and I pass that field into the expression rule as a parameter, I get the same error as before.  Oh well.  At least I can pass in a pv array variable.  Thanks.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am having problems writing an expression rule that uses displayvalue() functio</title><link>https://community.appian.com/thread/23272?ContentTypeID=1</link><pubDate>Fri, 02 Oct 2015 18:43:18 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:9ceaa569-39b3-4124-9c42-db70681ab8e4</guid><dc:creator>sikhivahans</dc:creator><description>@briank Great, the reason why I suggested using the null as default value instead of "" or {} is, it's not the right way to store "" or {} into the cdt variable. Also now you could try to return the cdt as a default value if needed, as the error is resolved.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am having problems writing an expression rule that uses displayvalue() functio</title><link>https://community.appian.com/thread/23270?ContentTypeID=1</link><pubDate>Fri, 02 Oct 2015 18:16:27 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6787b3a8-a7de-442f-a62b-93f854df45c0</guid><dc:creator>briank538</dc:creator><description>Thanks Sikhivahans.  That took care of the problem.  And I returned &amp;quot;null&amp;quot; (without quotes) in the default value parameter and it worked fine.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am having problems writing an expression rule that uses displayvalue() functio</title><link>https://community.appian.com/thread/23263?ContentTypeID=1</link><pubDate>Fri, 02 Oct 2015 11:42:59 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a204cd18-b30a-428c-89e6-50f78610bb3d</guid><dc:creator>sikhivahans</dc:creator><description>@briank I would like to say that your expression body exactly doesn't already look like that. So the definition of findBusinessRuleCDT rule which you have created is as follows:&lt;br /&gt;&lt;br /&gt;fn!displayvalue(ri!ruleName,ri!businessRuleArray.busrules_name,ri!businessRuleArray,ri!defaultBusinessRule)&lt;br /&gt;Here if you see the second argument of displayvalue(), you are using an inexistent field, namely 'busrules_name' in cdt. Even the logs are suggesting the same.&lt;br /&gt;&lt;br /&gt;The suggestion which I have made is as follows after correction of busrules_name to busrule_name in second argument of displayvalue() in findBusinessRuleCDT rule:&lt;br /&gt;fn!displayvalue(ri!ruleName,ri!businessRuleArray.busrule_name,ri!businessRuleArray,ri!defaultBusinessRule)&lt;br /&gt; &lt;br /&gt;I would like to suggest to proceed with conclusions after the correction of error in current implementation.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am having problems writing an expression rule that uses displayvalue() functio</title><link>https://community.appian.com/thread/23260?ContentTypeID=1</link><pubDate>Fri, 02 Oct 2015 04:43:07 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6138844a-5f92-4c3a-8c2e-fccaa2c031f0</guid><dc:creator>briank538</dc:creator><description>My expression body already looks like that.&lt;br /&gt;&lt;br /&gt;So, in essence, I can&amp;#39;t use displayvalue() inside an expression rule when passing my own CDT types because I&amp;#39;ll get the type mismatching error resulting in what looks like bad 4th argument to displayvalue().  That mean&amp;#39;s I&amp;#39;ll always have to rely on script tasks to search through a CDT typed array variable.  Do you have any java plug-in source code examples of searching or looping through a CDT array typed pv?  It looks like I may have to resort to that.&lt;br /&gt;&lt;br /&gt;Would it be possible for Appian to incorporate same logic into the expression rule as you do in the SAIL forms?  That way I can do exactly what I am trying to do here.  In SAIL forms, you can declare a parameter as Any Type and pass in your own CDT typed pv&amp;#39;s and at run time it figures it out type when dereferencing a member of the CDT parameter.  That would open up so much more functionality and make expression rules even more useful.  I hope Appian would consider this.&lt;br /&gt;&lt;br /&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am having problems writing an expression rule that uses displayvalue() functio</title><link>https://community.appian.com/thread/23259?ContentTypeID=1</link><pubDate>Fri, 02 Oct 2015 04:19:47 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:868d1647-213a-4a92-a523-70957eafe28c</guid><dc:creator>sikhivahans</dc:creator><description>Well I meant to say that you need to update the definition of the rule!findBusinesRulesCDT() as follows:&lt;br /&gt;&lt;br /&gt;fn!displayvalue(ri!ruleName,ri!businessRuleArray.busrule_name,ri!businessRuleArray,ri!defaultBusinessRule)&lt;br /&gt;&lt;br /&gt;And yes you can&amp;#39;t have your own type for the data type of the input(in expression rules I guess), and therefore you need to carefully configure the column which you are going to make use of. Anyhow the logs and alerts are there for us to let us know the issues.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am having problems writing an expression rule that uses displayvalue() functio</title><link>https://community.appian.com/thread/23258?ContentTypeID=1</link><pubDate>Fri, 02 Oct 2015 04:04:58 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:da065e91-dedd-467f-82de-8924bbc91b78</guid><dc:creator>briank538</dc:creator><description>Well, we have a chicken and the egg problem then.&lt;br /&gt;&lt;br /&gt;In defining the input parameters to the expression rule, I can&amp;#39;t set the types to my own CDT.  It doesn&amp;#39;t show up.  Only the System Types.  The only thing I can possibly set it to is Any Type.&lt;br /&gt;&lt;br /&gt;So, how I am supposed to get around that?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am having problems writing an expression rule that uses displayvalue() functio</title><link>https://community.appian.com/thread/23257?ContentTypeID=1</link><pubDate>Fri, 02 Oct 2015 04:00:17 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:29a6fb8d-e042-4c18-9e7a-857e352efabc</guid><dc:creator>sikhivahans</dc:creator><description>@briank So if we keenly observe the 'Caused by' in logs that suggests the issue some times. As per the logs attached by you, accessing an invalid field in cdt is causing the  issue.&lt;br /&gt;&lt;br /&gt;Caused by: java.lang.IllegalArgumentException: Invalid index: Cannot index property 'busrules_name' of type Text into type PRQ_Config_BusRules?list&lt;br /&gt;&lt;br /&gt;Now if we take a look at the cdt structure, busrule_name exists but busrules_name doesn't exist. So please correct the definition of displayvalue() in findBusinessRulesCDT rule accordingly, 2nd parameter is wrong here. And one more correction I would like to make here is, earlier you said that the same worked in process but it's not true I guess. As you refer the column from the PV, you might not have made a mistake. But in the rule, you are manually including the column name and so there has been a mistake which is causing the rule to fail. &lt;br /&gt;&lt;br /&gt;Please try the above suggestion and do let us know if you have any follow up questions or issues.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am having problems writing an expression rule that uses displayvalue() functio</title><link>https://community.appian.com/thread/23256?ContentTypeID=1</link><pubDate>Fri, 02 Oct 2015 03:38:08 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:801ae76c-2a3c-42d6-94d3-51ceb03ed98a</guid><dc:creator>briank538</dc:creator><description>Same error.  I&amp;#39;ve attached the application server log relating to the error.  Thanks.&lt;br /&gt;&lt;p&gt;&lt;a href="/cfs-filesystemfile/__key/communityserver-discussions-components-files/15/error_2D00_log_2D00_entry.txt"&gt;error-log-entry.txt&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am having problems writing an expression rule that uses displayvalue() functio</title><link>https://community.appian.com/thread/23255?ContentTypeID=1</link><pubDate>Fri, 02 Oct 2015 02:49:27 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b7974876-00fc-41ab-88f6-dc46d066c79e</guid><dc:creator>sikhivahans</dc:creator><description>@briank Could you please try the below definition for rule!findBusinessRuleCDT()?&lt;br /&gt;&lt;br /&gt;fn!displayvalue(ri!ruleName, ri!businessRuleArray.busrules_name, ri!businessRuleArray, null)&lt;br /&gt;&lt;br /&gt;Also as already asked, would you be able to reproduce the logs at the time when you are experiencing the error?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am having problems writing an expression rule that uses displayvalue() functio</title><link>https://community.appian.com/thread/23225?ContentTypeID=1</link><pubDate>Thu, 01 Oct 2015 22:57:05 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:50034d7b-143b-4f31-a9b0-d264ff579975</guid><dc:creator>briank538</dc:creator><description>The &amp;quot;fn!&amp;quot; infront of the displayvalue() call inside an expression rule did not work either.  Same error about the 4th argument.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am having problems writing an expression rule that uses displayvalue() functio</title><link>https://community.appian.com/thread/23216?ContentTypeID=1</link><pubDate>Thu, 01 Oct 2015 22:23:18 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1b1e2929-e924-49a9-8903-43aef53f7e7d</guid><dc:creator>sikhivahans</dc:creator><description>@briank Definitely there are other ways of doing it, but I opine that it's not a great idea to deviate from usage of fn!displayvalue() just because of the reason that it's throwing an error when being wrapped inside an expression rule. I would like to suggest to resolve the issue - If possible I would like to suggest to cross check the data types of the arguments and values of the arguments that were being passed to the expression rule. As long as the data types of the arguments and the values passed to them(check the data type of the PV as well at the same time) are perfect, then fn!displayvalue() should also work. If possible I would like to suggest you to review logs when you are experiencing this error.&lt;br /&gt;&lt;br /&gt;I might be wrong with this particular point, but I would like to suggest to use fn! as the context for displayvalue, just in case to avoid collision with a rule created (if any) with same name.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am having problems writing an expression rule that uses displayvalue() functio</title><link>https://community.appian.com/thread/23214?ContentTypeID=1</link><pubDate>Thu, 01 Oct 2015 22:10:09 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d6a76a8a-171e-4a16-9d98-573feedbf5c5</guid><dc:creator>briank538</dc:creator><description>I&amp;#39;d like to abstract away the complexity of the CDT&amp;#39;s I am designing by writing helper expression rules.  If displayvalue() can&amp;#39;t be used inside an expression rule, do you have any suggestions on an alternative method to find and return a CDT from inside an expression rule?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am having problems writing an expression rule that uses displayvalue() functio</title><link>https://community.appian.com/thread/23211?ContentTypeID=1</link><pubDate>Thu, 01 Oct 2015 21:59:56 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:56e88077-7eb5-4cdb-af38-cf013701e9cf</guid><dc:creator>briank538</dc:creator><description>vinitl522/mikej, I have no problems calling displayvalue() directly.  It&amp;#39;s when I use it in an expression rule it fails.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am having problems writing an expression rule that uses displayvalue() functio</title><link>https://community.appian.com/thread/23209?ContentTypeID=1</link><pubDate>Thu, 01 Oct 2015 21:51:36 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:aa73202d-d628-40b7-b70e-9be430f5ec67</guid><dc:creator>briank538</dc:creator><description>I tried placing {}, &amp;quot;&amp;quot;, and finally passing into my expression rule a default value where I pass in a pv of that CDT type.  Even that blows up with the same exact error on the 4th parameter to the displayvalue() which is the default value argument.&lt;br /&gt;&lt;br /&gt;It only seems to work if I use displayvalue() straight on instead of abstracting it away in an expression rule.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am having problems writing an expression rule that uses displayvalue() functio</title><link>https://community.appian.com/thread/23207?ContentTypeID=1</link><pubDate>Thu, 01 Oct 2015 21:45:23 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b3c78ebd-68a2-4741-ade8-2f40afce6fe7</guid><dc:creator>Mike James</dc:creator><description>I also get the appropriate results when testing the expression in isolation.   As with vahluwalia, this leads me to believe that the issue must exist with the way you are calling the rule - namely the default value.  What is the value of ri!defaultBusinessRule you are passing in? Are you just trying to pass in an empty CDT or does this have actual default value?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am having problems writing an expression rule that uses displayvalue() functio</title><link>https://community.appian.com/thread/23206?ContentTypeID=1</link><pubDate>Thu, 01 Oct 2015 21:42:34 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2ef9e91e-bfda-40ff-90b5-249ffddfc717</guid><dc:creator>briank538</dc:creator><description>Here you go.&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="/cfs-filesystemfile/__key/communityserver-discussions-components-files/15/findBusinessRuleCDT-call.png"&gt;&lt;img src="/cfs-filesystemfile/__key/communityserver-discussions-components-files/15/findBusinessRuleCDT-call.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="/cfs-filesystemfile/__key/communityserver-discussions-components-files/15/Process-Variables-of-Failed-Find-CDT-task.png"&gt;&lt;img src="/cfs-filesystemfile/__key/communityserver-discussions-components-files/15/Process-Variables-of-Failed-Find-CDT-task.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="/cfs-filesystemfile/__key/communityserver-discussions-components-files/15/Find-CDT-Task.png"&gt;&lt;img src="/cfs-filesystemfile/__key/communityserver-discussions-components-files/15/Find-CDT-Task.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="/cfs-filesystemfile/__key/communityserver-discussions-components-files/15/findBusinessRuleCDT-definition.png"&gt;&lt;img src="/cfs-filesystemfile/__key/communityserver-discussions-components-files/15/findBusinessRuleCDT-definition.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am having problems writing an expression rule that uses displayvalue() functio</title><link>https://community.appian.com/thread/23204?ContentTypeID=1</link><pubDate>Thu, 01 Oct 2015 20:54:50 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8a278346-9bd7-4fb7-a984-bc726043a444</guid><dc:creator>vineeta6579</dc:creator><description>I tested same use case on 7.9 version and it worked. can you please provide screenshot of it (expression rule &amp;amp; process snippet from where the expression rule is getting called).&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am having problems writing an expression rule that uses displayvalue() functio</title><link>https://community.appian.com/thread/23200?ContentTypeID=1</link><pubDate>Thu, 01 Oct 2015 19:50:56 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ff205787-9bca-45aa-8f37-87ea1c6ae055</guid><dc:creator>briank538</dc:creator><description>I tried that.  Didn&amp;#39;t work.  I&amp;#39;m on 7.9.  I don&amp;#39;t know if that makes a difference.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am having problems writing an expression rule that uses displayvalue() functio</title><link>https://community.appian.com/thread/23199?ContentTypeID=1</link><pubDate>Thu, 01 Oct 2015 19:39:33 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d14975f3-426e-4818-8318-bb9bf44c29dd</guid><dc:creator>vinitl522</dc:creator><description>keep the 4th value as {}&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I am having problems writing an expression rule that uses displayvalue() functio</title><link>https://community.appian.com/thread/23197?ContentTypeID=1</link><pubDate>Thu, 01 Oct 2015 19:28:21 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:12a16a73-1140-47de-ae7e-0ff77b9182c1</guid><dc:creator>briank538</dc:creator><description>...in a default CDT in.&lt;br /&gt;&lt;br /&gt;I keep getting the same errors.&lt;br /&gt;&lt;br /&gt;Am I missing something or is this not supported in an expression?  I got it work directly calling displayvalue(), but not in an expression rule.  Help!&lt;br /&gt;&lt;br /&gt;Thanks.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>