Change price by date - how to create logic based on date of response? | Community
Skip to main content
Answered

Change price by date - how to create logic based on date of response?


Forum|alt.badge.img+1
  • Sharing wisdom
  • 10 replies

Hello! Our event has earlybird, regular, and late pricing. I would like to create logic to assign the correct price based on the current date. 

When we get a data export (Google Sheets), the information contains a date field, but I suspect this is only generated on submission. I have tried to do an integration with Google Calendar, but it looks like that only lets you create or reference an event. 

Is there an integration or other strategy that would allow logic fields that reference the current date? My vision is to have something along the lines of:

If [today’s date] is LESS THAN [established date A], add @early_ticket to @price.

If [today’s date] is GREATER THAN [established date B], add @late_ticket to @price.

If [today’s date] is GREATER THAN [established date A] and LESS THAN [established date B], add @regular_ticket to @price.

I know there may be logic nuance there, but the main question here is whether it is possible to pull and reference a current date field for the purposes of the logic.

Thank you!

~~Jennifer

Best answer by Liz

Hi @jshirk That’s a great question. Our logic isn’t complex enough yet to recognize today’s date, so you would need to set an actual date for the logic jump. My suggestion would be to edit the form each time you need to change the date in the logic. 

View original

7 replies

Liz
Community Team
Forum|alt.badge.img+5
  • Tech Community Advocate
  • 14960 replies
  • Answer
  • March 2, 2023

Hi @jshirk That’s a great question. Our logic isn’t complex enough yet to recognize today’s date, so you would need to set an actual date for the logic jump. My suggestion would be to edit the form each time you need to change the date in the logic. 


Forum|alt.badge.img+5
  • Community Wizard
  • 127 replies
  • March 2, 2023

You have two ways to automate that:

  1. Use the Typeform Create API. You run an update every day to adjust the form based on the real date. Advantage: this is the most secure form, as you are sure not one can hack your code in the front end to get the coupon. Disadvantage: This requires to set a process that run in the backend.
    https://www.typeform.com/developers/create/
  2. Use the Javascript Embed API. With a few lines of Javascript, you compare the current date with dates A & B, and based on that, you pass a hidden variable with the value early, regular or late. Based on the value of that hidden variable, you apply logic in your Typeform. Advantage: easier to setup. Disadvantage: you need to embed the form into a website for Javascript to check today’s date

Forum|alt.badge.img+1
  • Author
  • Sharing wisdom
  • 10 replies
  • March 3, 2023
Liz wrote:

Hi @jshirk That’s a great question. Our logic isn’t complex enough yet to recognize today’s date, so you would need to set an actual date for the logic jump. My suggestion would be to edit the form each time you need to change the date in the logic. 

@Liz when you say “set an actual date for the logic jump,” do you mean just manually change the logic on the date when the prices change?

If yes, a follow up question. I have the form connected to a Google Sheet for our records and other work. If I change the price mid-way through, will that also change the price in the Sheet for previous registrants? I know it wouldn’t change what people actually paid, but it could complicate our record keeping. Easy way around that would be to archive the records at the date of change, but it would still be good to know how the logic would affect a live sheet.

Thank you!


Forum|alt.badge.img+1
  • Author
  • Sharing wisdom
  • 10 replies
  • March 3, 2023

@jeremielp Thank you for your tech-savvy answers! I know that will help others who are looking ways to tackle this question in the future. I’m afraid I’m probably not at that level myself and will take the more straightforward (if less elegant) approach just given my near-term need this go-round, but will definitely look at this for future use.


john.desborough
Forum|alt.badge.img+6
  • Certified Partner & Champion
  • 5294 replies
  • March 3, 2023
jshirk wrote:
Liz wrote:

Hi @jshirk That’s a great question. Our logic isn’t complex enough yet to recognize today’s date, so you would need to set an actual date for the logic jump. My suggestion would be to edit the form each time you need to change the date in the logic. 

@Liz when you say “set an actual date for the logic jump,” do you mean just manually change the logic on the date when the prices change?

If yes, a follow up question. I have the form connected to a Google Sheet for our records and other work. If I change the price mid-way through, will that also change the price in the Sheet for previous registrants? I know it wouldn’t change what people actually paid, but it could complicate our record keeping. Easy way around that would be to archive the records at the date of change, but it would still be good to know how the logic would affect a live sheet.

Thank you!

@jshirk - changing the price in the form half way through, as you describe, won’t change the price of submitted records already in the google sheet. it would only be reflected in the values submitted into the google sheet at the time the respondent submits the form

 

des


Forum|alt.badge.img+1
  • Author
  • Sharing wisdom
  • 10 replies
  • March 6, 2023

@john.desborough and @Liz with this confirmed, that’s the route I will take! I’m going to be manually checking the form on a regular basis anyway, because we have some sessions that will need to be set to “Full” at a certain number of registrants (whole separate question thread I’ll tackle at a future date related to waitlists!).  Appreciate the help!


Liz
Community Team
Forum|alt.badge.img+5
  • Tech Community Advocate
  • 14960 replies
  • March 7, 2023

Glad to hear it, @jshirk ! Let us know how it goes!


Reply