Help with a dynamic short code

Home Forums How to Help with a dynamic short code

This topic contains 5 replies, has 2 voices, and was last updated by  admin 4 days, 4 hours ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #17440

    barb
    Participant

    Hi Team, I need to create a dynamic shortcode, so depending on field values, instruct the system which layout to use. I’ve only ever created a shorcode to check if a value is ‘equal to’, but I need to check if the value of a particular field is ‘between’ 2 values.

    For equal to, I would use this:
    layout=[if 7860 equals=”8″]”53″[/if 7860]

    How would I write the shortcode if I wanted to use layout 53 if the value of field ID 7860 is greater than 49, AND less than 101?

    Thank you!
    B.

    • This topic was modified 4 days, 6 hours ago by  barb.
    #17443

    barb
    Participant

    Ok, I Found this and it works, but need to make this more dynamic….

    This will check for greater than less than:
    layout=[if 7860 greater_than=49 less_than=101]”53″[/if 7860][if 7860 greater_than=100 less_than=200]”54″[/if 7860]]

    I would further need to check to accomplish this:
    If field A is less than 11, AND Field B is less than 11, use Layout 53.
    But also check if:
    If field A is less than 11, AND Field B is greater than 10 AND less than 21, use Layout 54.

    How would this be accomplished? I will keep trying to find the answer and update here if I manage to find it. Thanks!

    B.

    • This reply was modified 4 days, 5 hours ago by  barb.
    #17445

    admin
    Keymaster

    Hi!

    Okay so, you have too many variables for Formidable’s shortcode Conditions, so you’ll need to use some form level conditional logic.

    Add two fields to your form, make them visible to “Administrators” so users wont see them.
    Set the default values of the fields to 53 & 54 respectfully.
    . For field 53, set conditional logic to be “SHOW this field if ALL of the following match:
    – A is less than 11
    – B is less than 11
    . For field 54, set conditional logic to be “SHOW this field if ALL of the following match:
    – A is less than 11
    – B is greater than 10
    – B is less than 21

    Then, for your PRO2PDF shortcode…
    . layout=[A][B]

    Which ever field matches it’s conditional logic will be visible to administrators (hidden to users) and the other field will be blank so your layout will result in layout=53 or layout=54.

    We remain at your service.

    #17446

    admin
    Keymaster

    To extend the above functionality further, you could add a hidden calculated field to the form, we’ll call it [123]…
    . Set the calculated field to [A]+[B]

    Then, for your PRO2PDF shortcode…
    . layout=[123]

    And then you could use Formidable’s conditional shortcode to create or not create the PDF merge link…

    [if 123 greater_than=0][formidable-download form="abcde" dataset=[id] layout=[123]][/if 123]

    We remain at your service.

    #17447

    barb
    Participant

    Oh wow, I love this!! Thanks so much! I was working on a solution that would work, but not nearly as neat and tidy as this. 🙂

    Thanks for such a fast reply!
    Barb.

    #17448

    admin
    Keymaster

    Glad it worked for you and always happy to help. Let us know if you need anything, as we remain at your service.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.