<?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>value by ranges</title><link>https://community.appian.com/discussions/f/rules/25968/value-by-ranges</link><description>I need an expression which finds corresponding value based on ranges: 
 Input: x {v1,v2,...,vn+1} {r1,r2,...,rn} 
 Result: if (x&amp;lt;=r1) then v1 else if (x&amp;lt;=r2) then v2 .... else if (x&amp;lt;=rn) then vn else vn+1 
 
 Thanks</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: value by ranges</title><link>https://community.appian.com/thread/101591?ContentTypeID=1</link><pubDate>Wed, 21 Sep 2022 12:20:58 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e97bf113-2734-4a18-9f47-253f9cb4aed1</guid><dc:creator>Mike Schmitt</dc:creator><description>[quote userid="141206" url="~/discussions/f/rules/25968/value-by-ranges/101580#101580"]match function [/quote]
&lt;p&gt;I was wondering this too, though the issue might be on setting it up to handle arbitrarily-long input lists, instead of fixed-length lists.&amp;nbsp; That&amp;#39;s why it might end up needing to rely on looping functions and/or functions that loop inherently like where(), as Stefan suggested below.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: value by ranges</title><link>https://community.appian.com/thread/101581?ContentTypeID=1</link><pubDate>Wed, 21 Sep 2022 08:01:53 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6c722e23-2ec7-4a03-8c94-2aad4ffb90cb</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;Assuming that the list of ranges is sorted, the following code should do this. I use the list comprehension feature of operators to compare x to all ranges, the use where() to get the indexes of matches, pick the first match and the pick the value for that matching index.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!x: 4,
  local!values: {23, 5, 468, 123, 42, 500},
  local!ranges: {1, 2, 3, 4, 5},
  index(
    local!values,
    index(where(local!x &amp;lt;= local!ranges), 1, count(local!values)),
    0
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: value by ranges</title><link>https://community.appian.com/thread/101580?ContentTypeID=1</link><pubDate>Wed, 21 Sep 2022 07:40:29 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:df92d4c7-f14f-4e10-b692-8997bc26fd81</guid><dc:creator>deepakg681722</dc:creator><description>&lt;p&gt;can you use match function for this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: value by ranges</title><link>https://community.appian.com/thread/101579?ContentTypeID=1</link><pubDate>Wed, 21 Sep 2022 07:34:59 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:4790005e-1c45-4536-a7db-3111f94b6dba</guid><dc:creator>Nahum</dc:creator><description>&lt;p&gt;To my best understanding displayValue is checks for equality not for less or equal&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: value by ranges</title><link>https://community.appian.com/thread/101578?ContentTypeID=1</link><pubDate>Wed, 21 Sep 2022 07:28:21 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d13c3737-e30a-4263-825c-3b405841f1a9</guid><dc:creator>Harshit Bumb (Appyzie)</dc:creator><description>&lt;p&gt;displayValue() is the function you need.&amp;nbsp;&lt;br /&gt;&lt;a href="https://docs.appian.com/suite/help/22.3/fnc_conversion_displayvalue.html"&gt;docs.appian.com/.../fnc_conversion_displayvalue.html&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>