Multiple Rule conditions

Forums General discussion Multiple Rule conditions

This topic contains 2 replies, has 2 voices, and was last updated by  Ayanda Makhathini 3 months ago.

  • Author
    Posts
  • #23546

    Ayanda Makhathini
    Participant

    Hi Alex

    I’m trying to figure out how best to linked rules , basically what I’m trying to do is when a certain category is picked in a CCDD, on the quantity field change it must use a custom function to do the calculation , but when a that category is not selected it must use the same quantity field on change to calculate using a different custom function (I hope this makes sense). Been trying to use the linked rules but getting confused whether which rule must be indexed first or if its possible using the rules config or best to go using custom JS.

    Thanks

  • #23557

    Alexander Bautz
    Keymaster

    Hi,
    I’m not sure I understand exactly, but I guess a custom function would work better. Here is an example, but you must change it to fit your exact need:

    jQuery("#dffs_YourQuantityInputField input").on("change",function(){
      if(getFieldValue("The_CCDD_field_internalname") === "Your_Trigger_Value"){
        customCalculationFunction1();
      }else{
        customCalculationFunction2();
      }
    });

    Alexander

  • #23559

    Ayanda Makhathini
    Participant

    Hi Alex

    This example looks like it can definitely workout. I managed to get it to work using the quantity field onchange rule to call both functions and there are if statements in both functions to calculate when it equal to a certain category. I’m getting a different error now but it’s hard to explain still going to investigate whats the issue before thinking about opening another thread. Thank you

    Regards
    Mak

You must be logged in to reply to this topic.