5 Replies Latest reply: Dec 16, 2010 12:31 PM by Sharam Pourmir RSS

IF-Statement

Sharam Pourmir
Currently Being Moderated

Hi everybody,

 

i use a IF-Statement in BPM but without success, i am not sure if it works like how i use it:

 

IF(DO_Context = "A",getPrincipals(myDO_Context),getPrincipal(myDO_Context)) 

 

In one case i have only one principal in other case i have multi principals. The action depends on DO_Context.

 

Is that possible? If i use only the methods it works but not with the IF-Statement.

 

regards,

 

Sid

  • Re: IF-Statement
    Jun Wu
    Currently Being Moderated

    maybe this is better

    IF(string-equal(DO_Context, "A"),getPrincipals(myDO_Context),getPrincipal(myDO_Context))

     

    • Re: IF-Statement
      Sharam Pourmir
      Currently Being Moderated

      Hi John,

       

      I try it with string-equal(...) but unfortunately it does'n work.

       

      I try also a simple operation like 1=1 without success.

       

      
      IF( 1=1, getPrincipals(DO_BANF_Structure/genehmiger/rcdID),getPrincipal(DO_Employee/rcdCurrentUser)) 
      
      

       

      If i use only getPrincipals(myDO_Context) it works.

       

      Any ideas?

       

      regards,

       

      Sid

      • Re: IF-Statement
        Jun Wu
        Currently Being Moderated

        what's the type of DO_Context?

         

        it should work, you must do something wrong. there is nothing magic, just check carefully

        type the expression from scratch, do not copy

        or

        you can try with gateway.

        • Re: IF-Statement
          Sharam Pourmir
          Currently Being Moderated

          I think the problem is that the IF-Statement only works with identical returnvalues, because

           

          if i use the same returnvalue for "then" and "else" it works:

           

          
          IF( true,getPrincipals(...) ,getPrincipals(...) )  <-- works
          
          

           

           

          But if i use different returnvalues for "then" and "else" i get no result:

           

          
          IF( true,getPrincipals(...) ,getPrincipal(...) )    <---don't work
          
          

           

           

          My purpose is to bind the owner of a Human Task either to getPrincipals() or getPrincipal(). How would you realize this?

           

          regards,

           

          Sid

           

          Edited by: Sid on Dec 16, 2010 11:49 AM

          • Re: IF-Statement
            Sharam Pourmir
            Currently Being Moderated

            Hi John,

             

            you are right. It works, my mistake was that the "elsevalue" was null so the "thenvalue" can not be returned when the "elsevalue" is null. I think the method raise an exception. Now after i set a default value it works.

             

            regards,

             

            Sid