Condition fields to amounts

Hello

I'm new to Sugar.

I solicit your help on my problem below.

I have a field A, a field B, a field C and a field D which are in currency.

1) I would like field B not to appear if field A is greater than 0 and if field D remains at 0 (formula to be entered once the “dependent” box is checked).

2) Conversely, I'd like field C to appear if field A is filled in.

What would the formula be? I know how to do it when lists are present with isinlist, but not with amounts.

Thanks in advance for your help :)

  • Hey  

    Welcome to Sugar! Glad you are jumping right in. This one is kind of tough! I think I have a working example if you would like to test and then you can share any changes you might want to implement. 

    First, I have four currency fields with a default value of 0.00 and they are called:

    currencya_c
    currencyb_c
    currencyc_c
    currencyd_c

    In currencyb_c > Visible If formula:

    ifElse(and(greaterThan($currencya_c,0),equal($currencyd_c,0.00)),false,true)


    ifElse(condition, value to return if condition is true, value to return if condition is false). In the condition part, we check to see if Currency A is larger than 0 AND if Currency D is equal to 0.00. If that condition is true, we return the condition after which was False - meaning it won't show. If that condition is false, then it will give the third value of that formula, "true", meaning that it will be visible. 

    Now for Currency C, I used this formula:

    ifElse(or(greaterThan($currencya_c,0),greaterThan(0,$currencya_c)),false,true)


    If Currency A is greater than 0, or 0 is greater than Currency A (just in case it can be negative), then we return false - meaning this field won't show. If Currency A = 0.00 (nothing changed), then Currency C will be visible. 

    New record where everything is 0.00:



    Where A > 0 and D = 0.00:


    Currency B and C are hidden. Then if we add a value to D, B will now be visible:



    Let me know if this works for you! Would be more than willing to dive back in to make any changes.

    -casey

  • Hello

    Thank you so much, it works :) It's a huge help and I'll be able to use it as inspiration to build other formulas.

    In fact, I'm taking advantage of it because I'm stumbling on something more complex:

    My opportunities on Sugar are classified by market with a market_c field.

    Within these markets, opportunities are classified by probability with a proba_c field.

    Finally, some opportunities are made by partners who are in a long list with a partner_c field and a currency amount_partner_c field.

    Each time I choose a partner from this list, I'd like a field called “Total sum of partner opportunities” to total up all the opportunities with a certain probability (for example, 70% or higher) where this partner has been identified, so that I can track the amount he makes on market A, for example.

    In I need to create a “Total sum of partner opportunities” field, calculated using the formula :

    and(isInList($market_c,createList(“Market A”, “Market B”))), isinlist($proba_c,createList(“70%”, “80%”), add($partenaire_c, montant_partenaire_c)))

    But I'm not sure that this formula works and that it fetches all partner amounts from all market opportunities.