Add Specific Values If One Category Equals Certain Value And Another Category Another Value" request received

Comments

7 comments

  • Rainer Grabowski

    Hello Gert,

    you can use this:

     var cat1 = @Type Of Request
     var cat1calc = cat1 == "International" ? 75.00 : cat1 == "National/Local" ? 25.00 : "";
     var cat2 = @2nd Category;
     var cat2calc = cat2 == "Good" || cat2 == "OK" ? "YES" :  "NO"
    
    cat2calc == "YES" ? cat1calc : ""
    

    Or:

     var cat = @Type Of Request;
     var cat2 = @2nd Category;
     var cat2calc = cat2 == "Good" || cat2 == "OK" ? "YES" :  "NO"
     cat == "International" && cat2calc == "YES" ? 75.00 : cat == "National/Local" && cat2calc == "YES"  ? 25.00 : ""
    

    Rainer

    0
    Comment actions Permalink
  • Hamid

    Hi Gert,
    try like this

    var cat1 = @Type Of Request
    var cat2 = @Your_second_category
    var result_cat1 = cat1 == "International" ? 75.00 : cat1 == "National/Local" ? 25.00 : null
    var result_cat2 = cat2 == "GOOD" || "OK" ? result_cat1 : cat2 == "BAD" || "DUPLICATE"  ? null : cat2 == null ? "cat2 not selected"
    
    
    0
    Comment actions Permalink
  • Gert Mostert

    Hey guys, not one of below works. Rainer, yours returns a 0 on both calculations, Hamid, yours throws out the following error: Script syntax error

    0
    Comment actions Permalink
  • Rainer Grabowski

    Hi Gert,

    does it show 0 if you in cat1 one of the 2 options is selected and in cat2 "Good" or "Ok"?
    If so, did you enter "Good" and ""Ok" exactly the same way as inthe categor options?
    If they are exactly the same, please copy what you've entered into the calculation field or even better: Share a screenshot where the calculation field and the 2 category fields are shown.

    0
    Comment actions Permalink
  • Gert Mostert

    Hi Rainer, not sure how I can post a screenshot, but YES, it shows 0 even with the spelling the same.

    So just to be clear, I would like it to only count the values from 'Type Of Request' if 'Good' & 'Ok' is selected, if 'Bad', 'Pending' or 'Duplicate' is selected it shouldn't count the values.

    Herewith manual screenshot:

    'Type Of Request' (Category 1) :

          'Not Yet Allocated' (Option 1)      [Value if selected 0.00]
          'International' (Option 2)                    [Value if selected 75.00]
          'National/Local' (Option 3)                 [Value if selected 25.00]
    

    'Quality Of Lead' (Category 2) :

          'Good' (Option 1)                         [Count above values if selected]
          'Ok' (Option 2)                             [Count above values if selected]
          'Bad' (Option 3)                                 [DO NOT count above values if selected]
          'Pending' (Option 4)                          [DO NOT count above values if selected]
          'Duplicate' (Option 5)                        [DO NOT count above values if selected]
    

    'Cost Of Lead' (Calculation Field):

    var cat1 = @Type Of Request
    var cat1calc = cat1 == "International" ? 75.00 : cat1 == "National/Local" ? 25.00 : "";
    var cat2 = @Quality Of Lead;
    var cat2calc = cat2 == "Good" || cat2 == "Ok" ? "YES" : "NO"

    cat2calc == "YES" ? cat1calc : ""

    0
    Comment actions Permalink
  • Rainer Grabowski

    Hi Gert,

    everything looks ok. I've duplicated your setup and it works. See screenshots:
    http://goo.gl/c7C0fS
    http://goo.gl/9pVisY

    Please check the category options, if there is a blank space behind the option text (if so, delete the blank space).
    Is "Quality Of Lead" a single choice field? If it's multi choice the calculation has to changed ( I ask cause you have written in your last posting

    if 'Good' & 'Ok' is selected,

    but in your first posting:

    IF either of GOOD or OK gets selected

    Rainer

    0
    Comment actions Permalink
  • Gert Mostert

    It works perfectly thanks Rainer....it seems like there was a 'space' added behind Good on the category selection....won't say anything further....

    Thanks again!!

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk