<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/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>General</title><link>https://www.infopathdev.com:443/forums/41.aspx</link><description>If you're not sure where to ask your question, ask it here. If necessary, our moderators will make sure it gets classified in the correct board.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: How to do complex formatting rules</title><link>https://www.infopathdev.com:443/forums/thread/96147.aspx</link><pubDate>Thu, 27 Feb 2014 10:47:52 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:96147</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/96147.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=96147</wfw:commentRss><description>&lt;p&gt;You can manually enter a formula by selecting &amp;quot;The expression&amp;quot; from the left dropdown in the condition builder, but if you&amp;#39;re going to be applying these complex&amp;nbsp;formatting rules to lots and lots of controls, that&amp;#39;s all the more reason not to be copying a manually-constructed expression from place to place.&lt;/p&gt;&lt;p&gt;I can understand you not wanting to add extra fields, though, so here&amp;#39;s a sample form that uses a similar trick without requiring extra fields to be added to the main data source.&lt;/p&gt;</description></item><item><title>Re: How to do complex formatting rules</title><link>https://www.infopathdev.com:443/forums/thread/96142.aspx</link><pubDate>Thu, 27 Feb 2014 10:10:00 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:96142</guid><dc:creator>elcoms</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/96142.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=96142</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hi,&lt;/p&gt;&lt;p&gt;&amp;nbsp;thank you. A non displayed field would be handy in this case,&amp;nbsp;but since it is a SharePoint list form, every extra field results to&amp;nbsp;an extra column in the list - not good.&lt;/p&gt;&lt;p&gt;The manual&amp;nbsp;rule definiton&amp;nbsp;sounds interesting, how does it work?&amp;nbsp; I&amp;nbsp;simplified the condition for this example. In fact, I&amp;nbsp;got 8 status values, and 5 different rule sets (condition matrices). One of the rule sets needs to be&amp;nbsp;applied to each of the 21 controls of the form.&lt;br /&gt;So copy/paste of complete&amp;nbsp;rule sets is quite essential for not going nuts.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: How to do complex formatting rules</title><link>https://www.infopathdev.com:443/forums/thread/96140.aspx</link><pubDate>Thu, 27 Feb 2014 08:12:54 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:96140</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/96140.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=96140</wfw:commentRss><description>&lt;p&gt;It is possible to define more complex expressions by entering your own manually, but I like to avoid that when possible&amp;nbsp;because you lose the built-in checking that comes with the InfoPath designer. It is possible to define your condition in terms of disabling the button, using the following rules:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Rule 1:&amp;nbsp;Disable if Status = 1&amp;nbsp;AND p1 = current user&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Rule 2:&amp;nbsp;Disable if Status =&amp;nbsp;1&amp;nbsp;AND p2 = current user&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Rule 3:&amp;nbsp;Disable if Status =&amp;nbsp;2&amp;nbsp;AND p1 = current user&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Rule 4:&amp;nbsp;Disable if Status =&amp;nbsp;2&amp;nbsp;AND p2 = current user&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Rule 5:&amp;nbsp;Disable if Status =&amp;nbsp;3&amp;nbsp;AND p1 != current user&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Rule 6:&amp;nbsp;Disable if Status =&amp;nbsp;4&amp;nbsp;AND p2 != current user&amp;nbsp;&lt;/p&gt;
&lt;/blockquote&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;To answer your second question, as with most programming languages, AND has a higher associativity than OR, so your example would be equivalent to &lt;strong&gt;(a = b&amp;nbsp;and a = c)&amp;nbsp;or a = d&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;One other option is to have a non-displayed field called something like &lt;strong&gt;EnableButton&lt;/strong&gt;, and give it a default value formula like:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&amp;nbsp;((Status = 1&amp;nbsp;or Status = 2)&amp;nbsp;and (p1 != current user&amp;nbsp;or p2 != current user )) or&amp;nbsp;(Status = 3&amp;nbsp;and P1 = current user)&lt;br /&gt;&amp;nbsp;or (Status = 4&amp;nbsp;and P2 = current user)&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&amp;nbsp;Then you can disable the button depending on whether that field is &lt;strong&gt;true&lt;/strong&gt; or &lt;strong&gt;false&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>Re: How to do complex formatting rules</title><link>https://www.infopathdev.com:443/forums/thread/96132.aspx</link><pubDate>Wed, 26 Feb 2014 17:35:16 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:96132</guid><dc:creator>Doreen</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/96132.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=96132</wfw:commentRss><description>&lt;p&gt;You might look into using xml expressions to accomplish that complexity in one condition, which I am no expert on. I think QRules could help you here.&lt;/p&gt;&lt;p&gt;I would also consider looking into&amp;nbsp;setting up User Roles.&amp;nbsp;(I use InfoPath 2007, Tools&amp;gt;User Roles.&amp;nbsp; Add a role then name it anything, assign users name from Active Directory,&amp;nbsp;individual or groups or if you haven&amp;#39;t alrady&amp;nbsp;set up an admin page on your form to collect current user names and add user names from the form to a role).&amp;nbsp; &amp;nbsp;Create a group of users called Status1234_users or P1P2_Users that includes&amp;nbsp;P1 and P2 users, then you can write individual conditions like:&lt;/p&gt;&lt;p&gt;if current user&amp;#39;s role != Status1234_users AND&lt;/p&gt;&lt;p&gt;Status&amp;nbsp;= 1, disable button&lt;/p&gt;&lt;p&gt;----&lt;/p&gt;&lt;p&gt;if current user&amp;#39;s role != Status1234_users AND&lt;/p&gt;&lt;p&gt;Status != 2, disable button&lt;/p&gt;&lt;p&gt;--- and so on&lt;/p&gt;&lt;p&gt;Or adjust your logic accordingly and write 6 individual conditions (eliminate the need to use AND and OR entirely).&amp;nbsp; Play around with this to see what happens.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p&gt;1. if status != 1 AND p1 = currentUser, disable button&lt;/p&gt;&lt;p&gt;2. if status != 2 AND p2 = currentUser, disable button&lt;/p&gt;&lt;p&gt;3. if status != 3 AND p1....&lt;/p&gt;&lt;p&gt;4. if status != 3 AND p2...&lt;/p&gt;&lt;p&gt;5. if status != 4 AND p1...&lt;/p&gt;&lt;p&gt;6. if status != 4 AND p2...&lt;/p&gt;&lt;p&gt;Your question about AND, OR...&lt;/p&gt;&lt;p&gt;The condition you wrote means:&lt;br /&gt;if (a = both b and c) or if (a=d only), do something (your first guess was correct!). :)&lt;/p&gt;</description></item><item><title>Re: How to do complex formatting rules</title><link>https://www.infopathdev.com:443/forums/thread/96131.aspx</link><pubDate>Wed, 26 Feb 2014 16:46:06 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:96131</guid><dc:creator>elcoms</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/96131.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=96131</wfw:commentRss><description>Thanks, maybe that would work, but I thought about it again and the condition is different:
&lt;br /&gt;&lt;br /&gt;
Enable button if ( (Status == 1 || status == 2) &amp;amp;&amp;amp; (p1 != current user || p2 != current user )&lt;br /&gt;
|| (Status==3 &amp;amp;&amp;amp; P1 == current user)&lt;br /&gt;
|| (Status = 4 &amp;amp;&amp;amp; P2 == current user) )&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;
The problem is that it is only possible to disable a button, not to enable it. When the condition is reversed to &amp;quot;disable button if..&amp;quot; it must be one single rule because of the top level ANDs, there is also no possibility to define paranthesis in rules, at least none I know of.
&lt;br /&gt;&lt;br /&gt;
btw. what does it mean when a rule is like:&lt;br /&gt;
a equals b AND&lt;br /&gt;
a equals c OR&lt;br /&gt;
a equals d&lt;br /&gt;&lt;br /&gt;

does it mean&lt;br /&gt;
(a==b &amp;amp;&amp;amp; a==c) || a==d&lt;br /&gt;
or&lt;br /&gt;
 a==b &amp;amp;&amp;amp; (a==c || a==d)&lt;br /&gt;
?</description></item><item><title>Re: How to do complex formatting rules</title><link>https://www.infopathdev.com:443/forums/thread/96090.aspx</link><pubDate>Mon, 24 Feb 2014 14:05:45 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:96090</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/96090.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=96090</wfw:commentRss><description>&lt;p&gt;How about two separate formatting rules:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;Condition: c is checked AND P1 does not contain current user&lt;br /&gt;Formatting: Disable button&lt;/p&gt;&lt;p&gt;Condition: c is not checked AND P2 does not contain current user&lt;br /&gt;Formatting: Disable button&lt;/p&gt;&lt;/blockquote&gt;</description></item><item><title>How to do complex formatting rules</title><link>https://www.infopathdev.com:443/forums/thread/96088.aspx</link><pubDate>Mon, 24 Feb 2014 13:00:57 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:96088</guid><dc:creator>elcoms</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/96088.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=96088</wfw:commentRss><description>I need to activate a deactivated a button with a complex rule like:

If (checkbox c is checked) {
    if (People Field P1 contains current user) {
       activate current button
    }
}
else 
{
    if (People Field P2 contains current user) {
       activate current button
    }
}

How is it possible without code?
Thanks!</description></item></channel></rss>