<?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>using if statements in interface</title><link>https://community.appian.com/discussions/f/user-interface/26120/using-if-statements-in-interface</link><description>Hi all, 
 I&amp;#39;m creating an interface that records and calculates the working hours for employees, the idea is if the working hours are less than 8 it should display: &amp;quot; Working hours are incomplete &amp;quot; , and if it was less than 0 it should display: &amp;quot; insert</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: using if statements in interface</title><link>https://community.appian.com/thread/102387?ContentTypeID=1</link><pubDate>Tue, 04 Oct 2022 15:31:52 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b6179261-407b-4ef9-accf-deae3e6d33e5</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;I&amp;#39;m not sure why it would be doing that - can you confirm what data type your ri!WorkingHours is?&amp;nbsp; If the value was somehow technically &amp;quot;greater than 8&amp;quot; (like perhaps in the back-end storing a value of 8.001 for example) then it would fail the condition.&amp;nbsp; To troubleshoot, maybe try wrapping &amp;quot;ri!workingHours&amp;quot; in the &amp;quot;value&amp;quot; parameter of a!match() in &amp;quot;tointeger()&amp;quot;, and see if that changes anything.&lt;/p&gt;
&lt;p&gt;Additionally, the &lt;em&gt;&lt;strong&gt;truly correct&lt;/strong&gt;&lt;/em&gt; way of using a!match would be that you only invoke ri!workingHours once, then refer to it as &lt;strong&gt;fv!value&lt;/strong&gt; within the &amp;quot;whenTrue&amp;quot; parameter, when needed.&amp;nbsp; The difference may appear cosmetic, though this means that if you format the value parameter (such as using &amp;quot;tointeger()&amp;quot;), then further references to the value will remain consistent.&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/13/pastedimage1664897541708v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using if statements in interface</title><link>https://community.appian.com/thread/102386?ContentTypeID=1</link><pubDate>Tue, 04 Oct 2022 15:23:48 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0ec4742b-cfef-44cc-b111-78c98262b431</guid><dc:creator>Ali Abdulqawi</dc:creator><description>&lt;p&gt;yes I did.&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/13/chrome_5F00_9DQmjcnB1m.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using if statements in interface</title><link>https://community.appian.com/thread/102383?ContentTypeID=1</link><pubDate>Tue, 04 Oct 2022 15:04:18 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:32bfd80f-3fe0-49ad-9818-4fddedfb5b56</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;This works fine for me.&amp;nbsp; Did you populate ri!WorkingHours correctly?&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/13/pastedimage1664895884722v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using if statements in interface</title><link>https://community.appian.com/thread/102378?ContentTypeID=1</link><pubDate>Tue, 04 Oct 2022 14:19:37 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:cb7ea8dd-9cd5-4532-af99-d907cec2cdae</guid><dc:creator>Ali Abdulqawi</dc:creator><description>&lt;p&gt;a!richTextDisplayField(&lt;br /&gt; labelPosition: &amp;quot;COLLAPSED&amp;quot;,&lt;br /&gt; value: {&lt;br /&gt; a!richTextItem(&lt;br /&gt; a!match(&lt;br /&gt; value: ri!WorkingHours,&lt;br /&gt; equals: 8,&lt;br /&gt; then: &amp;quot;Working Hours are complete&amp;quot;,&lt;br /&gt; whenTrue: and(ri!WorkingHours &amp;gt; 0, 8 &amp;gt; ri!WorkingHours),&lt;br /&gt; then: &amp;quot;Working hours are not complete&amp;quot;,&lt;br /&gt; default: &amp;quot;insert working hours correctly please&amp;quot;&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt; } &lt;br /&gt; ),&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using if statements in interface</title><link>https://community.appian.com/thread/102371?ContentTypeID=1</link><pubDate>Tue, 04 Oct 2022 11:48:27 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:cb15948f-77b6-4b89-a68f-131392d494e5</guid><dc:creator>Harshit Bumb (Appyzie)</dc:creator><description>&lt;p&gt;It is working fine for me. You must have misconfigured something. Can you add your code block for more understanding?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using if statements in interface</title><link>https://community.appian.com/thread/102369?ContentTypeID=1</link><pubDate>Tue, 04 Oct 2022 11:44:36 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:54097164-fdb7-45ff-8e3e-ae7b24b8a0aa</guid><dc:creator>ujjwalr0002</dc:creator><description>&lt;p&gt;workings hours as 8&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/13/pastedimage1664883867783v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;working hours as 4&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/13/pastedimage1664883889674v2.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using if statements in interface</title><link>https://community.appian.com/thread/102368?ContentTypeID=1</link><pubDate>Tue, 04 Oct 2022 11:41:26 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7c045feb-2e06-4e14-94e0-754f41cb1e38</guid><dc:creator>Harshit Bumb (Appyzie)</dc:creator><description>&lt;p&gt;Did you take a look at Ujjwal&amp;#39;s answer? I think it is a better approach.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using if statements in interface</title><link>https://community.appian.com/thread/102367?ContentTypeID=1</link><pubDate>Tue, 04 Oct 2022 11:41:15 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:def60774-a905-45e0-a520-a9e129d62a55</guid><dc:creator>Ali Abdulqawi</dc:creator><description>&lt;p&gt;it just show the default message even when the user inserts 8, or 4&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using if statements in interface</title><link>https://community.appian.com/thread/102366?ContentTypeID=1</link><pubDate>Tue, 04 Oct 2022 11:40:17 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6338da1c-d46c-4da8-9755-2988ddb97d76</guid><dc:creator>Ali Abdulqawi</dc:creator><description>&lt;p&gt;Thanks, it&amp;#39;s working now, but I&amp;#39;m wondering should I use three conditions every time I want use if statement?&lt;/p&gt;
&lt;p&gt;can&amp;#39;t I use two only?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using if statements in interface</title><link>https://community.appian.com/thread/102362?ContentTypeID=1</link><pubDate>Tue, 04 Oct 2022 10:51:59 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:4a425993-27f7-41c0-a3ca-d8fe0f1a9665</guid><dc:creator>Amaan Shekh</dc:creator><description>&lt;p&gt;its because the third if only have two parameters in it&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;if(
            ri!WorkingHours &amp;lt; 0,
            &amp;quot;insert working hours correctly please&amp;quot;
            )&lt;/pre&gt;&amp;nbsp;we can remove this or can pass on more parameter as&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;if(
            ri!WorkingHours &amp;lt; 0,
            &amp;quot;insert working hours correctly please&amp;quot;,
            &amp;quot;working hours passed limit&amp;quot;
          )&lt;/pre&gt;&amp;nbsp;, you can choose according to your use case&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using if statements in interface</title><link>https://community.appian.com/thread/102361?ContentTypeID=1</link><pubDate>Tue, 04 Oct 2022 10:49:28 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c433a2a0-5691-4ecb-8ffa-a1eb48c765f2</guid><dc:creator>Harshit Bumb (Appyzie)</dc:creator><description>&lt;p&gt;&lt;a href="/members/alim9650"&gt;Ali Abdulqawi&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I missed the third parameter in the last if. You can add an empty list there. I have updated the same code&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using if statements in interface</title><link>https://community.appian.com/thread/102360?ContentTypeID=1</link><pubDate>Tue, 04 Oct 2022 10:47:57 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:3652def0-f05a-4422-a013-93e5cd8c5753</guid><dc:creator>Amaan Shekh</dc:creator><description>&lt;p&gt;try this&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!richTextDisplayField(
  value: {
    a!richTextItem(
      if(
        ri!WorkingHours = &amp;quot;8&amp;quot;,
        &amp;quot;Working hours are complete&amp;quot;,
        if(
          and(8 &amp;gt; ri!WorkingHours, ri!WorkingHours &amp;gt; 0),
          &amp;quot;Working hours are not complete&amp;quot;,
          &amp;quot;insert working hours correctly please&amp;quot;
    
        )
      )
    )
  }
)&lt;/pre&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using if statements in interface</title><link>https://community.appian.com/thread/102359?ContentTypeID=1</link><pubDate>Tue, 04 Oct 2022 10:46:46 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:cf3d4508-9d50-4845-ad82-cfd70cafb906</guid><dc:creator>Ali Abdulqawi</dc:creator><description>&lt;p&gt;Thanks for your help, but when I tried the code I got this:&amp;nbsp;&lt;strong class="StrongText---richtext_strong StrongText---inMessageLayout StrongText---error"&gt;Could not display interface. Please check definition and inputs.&lt;/strong&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;Interface Definition: Expression evaluation error at function &amp;#39;if&amp;#39; [line 64]: Invalid number of parameters, function &amp;#39;if&amp;#39; a minimum of 3 parameters (condition,true,false), passed 2.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using if statements in interface</title><link>https://community.appian.com/thread/102356?ContentTypeID=1</link><pubDate>Tue, 04 Oct 2022 10:22:47 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6121632f-31ec-4f9e-b1c2-36a432bdbcf5</guid><dc:creator>ujjwalr0002</dc:creator><description>&lt;p&gt;Using the amazing match function.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!richTextDisplayField(
  value: {
    a!richTextItem(
      a!match(
        value: ri!WorkingHours,
        equals: 8,
        then: &amp;quot;Working Hours are complete&amp;quot;,
        whenTrue: and(ri!WorkingHours &amp;gt; 0, 8 &amp;gt; ri!WorkingHours),
        then: &amp;quot;Working hours are not complete&amp;quot;,
        default: &amp;quot;insert working hours correctly please&amp;quot;
      )
    )
  }
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using if statements in interface</title><link>https://community.appian.com/thread/102354?ContentTypeID=1</link><pubDate>Tue, 04 Oct 2022 10:08:37 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7d0d2846-fa94-4ac6-9a15-df629d09c9b0</guid><dc:creator>Harshit Bumb (Appyzie)</dc:creator><description>&lt;p&gt;Multiple conditions in Appian can be configured using or() &amp;amp; and() functions.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!richTextDisplayField(
  value: {
    a!richTextItem(
      if(
        ri!WorkingHours = &amp;quot;8&amp;quot;,
        &amp;quot;Working hours are complete&amp;quot;,
        if(
          and(8 &amp;gt; ri!WorkingHours, ri!WorkingHours &amp;gt; 0),
          &amp;quot;Working hours are not complete&amp;quot;,
          if(
            ri!WorkingHours &amp;lt; 0,
            &amp;quot;insert working hours correctly please&amp;quot;,
            {}
          )
        )
      )
    )
  }
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>