Conditional test for gift amount greater than X

Options
isGiftAmountGreaterThan shows up in the S-Tag reference in some sample code, but doesn't seem to work (at least on a thank you page).  The syntax is theoretically


dc:isGiftAmountGreaterThan:$60

which we expect would return 'true' if the gift amount listed on the thankyou page were greater than $60.


At least in the 'preview' mode for a Thank You page, I don't get 'true', even if the amount I'm testing for is $29 and the dummy 'gift amount' that is echoed with the dc:giftAmount s-tag returns '$40'.


Is there some method we can use to show conditional content on a donation thankyou page for people who gave more than X amount on the form?

 
Tagged:

Comments

  • I don't think the conditional will work properly in preview mode, since it keys on a gift amount that isn't truly there.


    You can also use the S130 tag to do math.


    https://community.blackbaud.com/forums/viewtopic/1/961?post_id=961#p961

     
  • What Brian said.... E130 all the way


    Here's what you could use for Donation Amount:

    [[?xFx::x[[E130:"[[S120:dc:giftAmount]]" 1 "[[S120:dc:giftAmount]]" length substring]] 29 > F T ?]]x::
    over $29
    ::
    under $29
    ]]
    What it's doing is stripping the dollar sign from the donation amount so that it's a number being evaluated and then assigning True and False to the greater than evaluation.


    Which basically could read:

    [[?xFx::x[[E130:50 29 > F T ?]]x::
    over $29
    ::
    under $29
    ]]
      Let me know if that works for you.


    Happy coding,

    Sara
  • you guys are incredibly helpful!
  • Hi, Sara !


    I was trying to setup a multi-part conditional and decided to check out the community before running to support. ​I'm in a similar spot to William who wrote earlier. For our capital campaign, donors will receive a certain number of characters for a recognition tile based on the amount of their gift. I want to have three options: above $999, above $499, above $249  and otherwise, show nothing. I tried to modify what you gave initially and wondered if you could tell me what I'm doing wrong! Thank you!


    [[?xFx::x[[E130:"[[S120:dc:giftAmount]]" 1 "[[S120:dc:giftAmount]]" length substring]] 999 > F T ?]]x::
    my content for $1000 givers and above::

    [[?xFx::x[[E130:"[[S120:dc:giftAmount]]" 1 "[[S120:dc:giftAmount]]" length substring]] 499 > F T ?]]x::

    my content for $500 givers and above::

    [[?xFx::x[[E130:"[[S120:dc:giftAmount]]" 1 "[[S120:dc:giftAmount]]" length substring]] 249 > F T ?]]x::

    my content for $500 givers and above::]]]]]]

    I'm not sure about those end brackets! Anything you can provide would be helpful.


    --Sincerely, Arielle

    Sara Hoffman
    :
    What Brian said.... E130 all the way

    Here's what you could use for Donation Amount:


    [[?xFx::x[[E130:"[[S120:dc:giftAmount]]" 1 "[[S120:dc:giftAmount]]" length substring]] 29 > F T ?]]x::
    over $29
    What it's doing is stripping the dollar sign from the donation amount so that it's a number being evaluated and then assigning True and False to the greater than evaluation.


    Which basically could read:

    [[?xFx::x[[E130:50 29 > F T ?]]x::
    over $29
    ::
    under $29
    ]]
      Let me know if that works for you.


    Happy coding,

    Sara

     

     

Categories