Discussions

 View Only
  • 1.  Same button takes some one to a different URL based upon the state.

    Posted 02-11-2022 16:17
    I am adding a Formula URL button to my form. When someone clicks on the button I would like it to take them a particular website based on the state.

    For Example:
    If someone is in the form for the state of Alabama, when they click the button, I want it to take them to the state of Alabama's website.
    If someone is in the form for the state of Arkansas, when they click the button, I want it to take them to the state of Arkansas's website.
    etc......

    What would that formula look like?

    Thank you for your time.

    ------------------------------
    Adam Ely
    ------------------------------


  • 2.  RE: Same button takes some one to a different URL based upon the state.

    Posted 02-11-2022 16:31
    I suggest that you make a table of states where the key field is the two letter state abbreviation. I'm going to assume that the record you're dealing with also have the state abbreviation code on them somewhere.   I'm sure you can Google and find an Excel sheet or copy paste where you can quickly enter the 50 states. 

    Add a field to your states table for the URL website.  

    And make a relationship where one state has many of your records. Lookup the URL website field down to your details table.  When the user selects a state, the lookup field will populate.

    This is a much better approach than hard coding the websites in a long formula as this way the ongoing maintenance of the URLs is by data entry and not coding changes.

    ------------------------------
    Mark Shnier (YQC)
    mark.shnier@gmail.com
    ------------------------------



  • 3.  RE: Same button takes some one to a different URL based upon the state.

    Posted 02-11-2022 18:06
    Edited by Jeff Peterson 02-11-2022 18:08

    You could do it like this in your Formula URL field  (This is the hard coded way that Mark mentions above):

    Case([State],
    "AL", "www.alabama.gov",
    "AR", "www.arkansas.gov",
    "AZ", "www.arizona.gov
    )


    And of course you'd need to list out all of the states and the URLs there, but this would work.



    ------------------------------
    Jeff Peterson
    ------------------------------