This topic contains 8 replies, has 0 voices, and was last updated by GAJ 8 years, 7 months ago.

  • Author
    Posts
  • #2831

    GAJ

    We’ve the need to access the {total} field value from within the header of a Quote/Estimate form.

    I’ve created a custom body field with Validation & Defaulting, Formula = Y.

    I added the field to the form in the Main, Primary Information section.

    Even with Validation & Defaulting set to just {total}, blank is returned.

    Ultimately, we need to execute something like this:

    (CODE)

    CASE {total}

    WHEN > 110000.00 THEN {total} * .02029

    END

    (/CODE)

    What is the proper syntax to use to access the {total} field in the header of a Quote/Estimate form?
    This is a cached copy. Click here to see the original post.

  • #2832

    k_dunc

    Hi GAJ, have you turned off (un-checked) the Store Value checkbox?

  • #2833

    GAJ

    Good, i.e. I understand your question. Yes, it is off. Thanks.

  • #2834

    k_dunc

    Great. So did that fix your issue though?

  • #2835

    Nelliott

    You might be better off, since you want to apply logic to this, using a script, maybe a client post sourcing function or maybe a user event before submit / before load, depending on when you’re expecting the field to populate.

    Maybe try:

    Code:
    CASE
    WHEN {total}> 110000.00 THEN ({total} * .02029)
    WHEN {total}< 110000.00 THEN ({total} * .02030)
    ELSE 'some_other_catch_all' END
    Though I don't write formula regularly your code looks like a mashup of sql / javascript to me

  • #2836

    GAJ

    Hi k_dunc, the Store Value was never turned on. I did have to go back and double check though.

    Hi Nelliott, the syntax of the CASE statement works both ways, though you might have something there with the parentheses.

    The CASE statement would be in the Validation & Defaulting Formula field in the Custom Body field.

    Similar logic works just fine, so scripting

    The problem is that even with a simple {total} entry there, ie. no CASE statement, a logic that works also when accessing many other native NS fields,

    this one doesn’t.

    This custom body field is placed right in the Primary Information section of the form… whose Total value is physically right next to it. Logically, it should be accessible as well. But it is not with the simple syntax {total}.

  • #2837

    michoel

    Weird, this works fine when I try it..

    What type of custom field are you using?

    Also, I’ve had trouble with the CASE (expr) WHEN (comparison_expr).. syntax. I’ve found CASE WHEN (expr) works more consistently.

  • #2838

    Nelliott

    Yeah, I just tried the same thing, what are you defining the field as?

    I used “Decimal Number”?

    See the screens I attached

  • #2839

    GAJ

    My BAD… I DID have Store Value checked! Argh! Unchecking, and following the advice herein, it works very nicely.

    Client wants to calculate and display monthly costs in a custom field in the Main header in the form based on the Quote total. The solution CASE statement is:

    CASE

    WHEN {total} > 110000.00 THEN {total}*.05

    WHEN {total} > 60000.00 THEN {total}*.06

    WHEN {total} >= 30000.00 THEN {total}*.07

    END

    Many thanks to all of you for taking your valuable time to help here. I really must pay it forward.


    michoel replied on 04/06/2016, 09:09 PM: Great to hear you worked it out. The syntax for code tags is [*CODE] [*/CODE] (without the *)

You must be logged in to reply to this topic.