Answered

Advanced Logic Text Edit or Backup


Userlevel 2
Badge

Hello,

 

I have a pretty long If/Goto logic ladder at the end of my form to choose between about 20 scenarios and 12 various ending pages. Is there a text-based way to enter/edit this information, instead of all the clicking through the GUI interface? Also, is there a way to backup/save this logic? I am terrified to modify the form in any way that may lose or alter this logic (i.e. change the question type, etc).

 

Thank you!

icon

Best answer by john.desborough 30 June 2022, 04:35

View original

13 replies

Userlevel 7
Badge +5

Hi @peter-humanfuel Depending on your tech level, you could use our API to add the logic to your form. 

As for a backup, we don’t have an automatic backup solution, but @john.desborough is the preacher of backing up forms and can share a bit more on how!

Userlevel 7
Badge +6

@peter-humanfuel - i know your pain of putting in large volumes of logic rules.. i did one form early in the calendar year for a client that had over 4000 (4k) logic rules - so big the logic map stopped working ( i think if stops at about 500 if i am not mistaken)  - and it was only at that point that I convinced the cilent that they had to break it into a series of smaller forms .. 

Since i try to do all things in Typeform without having to use/learn the API (so far successful !!) the logic rules builder is cumbersome but it is reasonably straight forward. While i agree that it would be really nice to be able to import the logic into what i would call a ‘logic block’ (essentially a ‘question’ that holds all the logic you need and can be inserted into your question flow at any point - you could have multiple logic blocks that you could save and insert in my perfect world) i think the bigger issue is “what is the input language/format/structure that can be used to import the logic? straight sql? python scripts? c# ?? cobol, heaven forbid!

I am hoping they get something like this but .. until they do, i go back to old school basics for ‘backups’: first at the macro level 

  • whenever i start a project i create a project workspace and a project_backup workspace 
  • i make a copy/duplicate of the file(s) as i finish working on it (could be for an hour or a day or a review cycle) and put it into the backup workspace. this includes the google sheet tow which i always always always connect my files (data backups etc)
  • when i have changes to make to a typeform, i make a copy of the production version and make all the changes necessary to that copy - they are autosaved (logic rules will be discussed next) at the question level - all the testing and review is done against this copy. 
    • before the typeform goes into testing, i put a copy of the file in the backups directory - not only do i have the original production version still in use but i have the copy that is being edited and a backup of the working copy (alongside the backup of the original) 

I am old enough to have worked with a dual floppy IBM PC then the XT with a 10mb hard drive and dual floppies. I have lost more files due to NOT saving periodically, blackouts and not having a ‘working backup’ of the production version. I have enough psychological scarring - just ask the 7 other voices in my head  - about lack of backups that i learned the hard way in my first typeform (lost the working logic trying to make a tweak.. dammit) that i religiously practice the above back up strategy. 

here’s a photo of some work for a client today - the original and versions 2 and 3 - iterations of questions and logic twice today… (there are backups of these files in the project backup workspace yessir!)

Now for the logic rules:

  • like your statement above not wanting to lose the input, I follow some simple (personal) guidelines when i am inputting logic rules into a form - they may seem crazy but … 
    • i create all the variables and save them all 
    • i create all the hidden variables and save them all. 
    • in the logic rule creation, I SAVE the logic after every question’s logic rules are input
      • yes this might seem like a lot if you have 40 questions in your form BUT you might want to think about the design of your form and not the logic here
      • yes it means i have to go back into logic and branching again and navigate to where i am inputting the next set of rules, but it means less chance for data loss
    • IF i have a long set of logic rules that i have input, say to calculate the highest subtotal out of 5, and I am putting all these rules on a single question, then every 10 logic rules in my list i will save the logic rules and then go back in and add the next 10
      • in an example of 5 question groups of 5 questions with 5 answers in each AND determining the top ranked subtotal, there were 190 logic rules in the ‘ranking’ run - so there were 19 “saves’ of the logic and 25 saves for each of the questions. 

I know that is a pain for most people.. and it can be mind numbing to sit there and walk through the sequence for each rule.. but i find that it takes the same amount of time as writing the entire set of sql statements that i would use to do the same thing and then port it into Typeform by the api. You still have to test the logic works in the ‘outside world’ and then import it and test it inside the typeform to make sure that it works. Why duplicate the testing effort? 

 

it’s old school.. downright curmudgeonly way of doing things. but it reduces the amount of times that I have lost stuff - you also never know when there is going to be an issue between your browser and the Typeform servers: get used to saving your logic work and don’t rely on the autosave (that works on question changes but not logic!!!)

 

ok.. that was much longer but @Liz gave me the pulpit and i preached from my soapbox…(sort of feels like being at Speaker’s Corner) lol.. 

 

cheers

 

des

Userlevel 2
Badge

Wow! Very helpful and insightful, sounds like you’ve learned this the hard way in some cases! And you have a lot more patience than me! Going to implement some of this and tread carefully!

Userlevel 2
Badge

@john.desborough Here is another question - can I re-order logic statements? I have a long If/Then ladder that is in the exact opposite order - do I have to delete and start from scratch (I hope not!)?

Userlevel 2
Badge

AND, can I have multiple actions per IF statement? I want to set a variable and jump to a case based on the same condition…

 

Userlevel 7
Badge +6

@john.desborough Here is another question - can I re-order logic statements? I have a long If/Then ladder that is in the exact opposite order - do I have to delete and start from scratch (I hope not!)?

There is currently no method that i know of that will allow you to drag and drop the logic rules @peter-humanfuel  ( @Liz - can you validate that please: I think it might be something the product team is working on but...) 

thing to keep in mind when creating the logic rules at any point in time: create the strictest first and end with the least restrictive - here’s a link to a video by typeform that talks about that 

  • ie if A and B and C are all ‘true” then goto q6
  • if A and B are true go to q8
  • if A is true go to q10

(having had to delete and reinstate logic paths in Typeform a number of times, having it all laid out beforehand helps.. even if you use something like Miro as a flowcharting tool to walk through the logic before getting into typeform.. i also use markers on my windows to draw things lol)

if your ‘logic ladder is the inverse, for example, of the 3 bullets above, when it hits the first condition (a is true) it is going to head to q10 … even if  A and B and C are also true, it would never get to that condition…

 

helpful or does it make you grind your teeth?

 

Userlevel 7
Badge +6

AND, can I have multiple actions per IF statement? I want to set a variable and jump to a case based on the same condition…

 

@peter-humanfuel  nope.. one action per.. and honestly, if you can keep it to one action per logic rule it is easier to troubleshoot as  you go forward … 

 

des

Userlevel 2
Badge

@john.desborough Here is another question - can I re-order logic statements? I have a long If/Then ladder that is in the exact opposite order - do I have to delete and start from scratch (I hope not!)?

There is currently no method that i know of that will allow you to drag and drop the logic rules @peter-humanfuel  ( @Liz - can you validate that please: I think it might be something the product team is working on but...) 

thing to keep in mind when creating the logic rules at any point in time: create the strictest first and end with the least restrictive - here’s a link to a video by typeform that talks about that 

  • ie if A and B and C are all ‘true” then goto q6
  • if A and B are true go to q8
  • if A is true go to q10

(having had to delete and reinstate logic paths in Typeform a number of times, having it all laid out beforehand helps.. even if you use something like Miro as a flowcharting tool to walk through the logic before getting into typeform.. i also use markers on my windows to draw things lol)

if your ‘logic ladder is the inverse, for example, of the 3 bullets above, when it hits the first condition (a is true) it is going to head to q10 … even if  A and B and C are also true, it would never get to that condition…

 

helpful or does it make you grind your teeth?

 

Helpful AND makes me want to grind teeth! I did see that link and that is my current order of things. Essentially the If/Then ladder exits as soon as it finds a match, right? Here is how my form looks:

 

 

This functionally works, but has the limitation that my Results log and Notification emails do not show the “result” (i.e. which Ending Page was visited). I want to be able to know what recommendation (Ending Page) was made for each submission. Make sense?

I am trying to refactor it as such:

  • Introduce a variable called “recommendation”.
  • Perform my If/Then case structure to set the recommendation variable.
  • Then perform a simple 1-to-1 If/Go-To for each ending based on the recommendation variable.

If I change from an If/Go-To to an If/Replace structure, then the order of the logic statements needs to be reversed, right? Because instead of exiting at the first match (where the top statements have highest priority), it will always run all the way down the list (making the bottom statement highest priority). Yes?

For a bit more context, my form is 1-4 (check all that apply) questions collecting a bunch of concerns, then recommending a solution. The recommendation logic is a list of priority-based triggers, where the first one that is true should point to the recommended solution. 

 

Userlevel 7
Badge +6

@peter-humanfuel - make a duplicate of the form and try this test:

  • create a variable called v_ending (text, default = empty)
  • go to logic branching and to your email question
  • at the of all the logic add another rule 
    • if q1=a replace v_ending with A
  • save the logic 
  • publish that form 
  • go back to logic and look at the order of the rules - i believe that Typeform (still) will push the Replace options in front of the goto rules.. 

if that test holds true and the replace rule is before the goto rules, then go back in and set the rules up for populating with the ending identifier. 

 

If you are using an Outcome quiz type in Typeform it will display in the Results tab but if you are scoring a quiz, then the above is probably the easiest way to go

 

des

Userlevel 2
Badge

@john.desborough thank you! This worked, you’re the king of “working with what we got”! I flipped each one from Go-To to Replace bottom-up, 1by1, Saving between each one and it reversed the order as I needed it to. Then added some simple Go-To logic after. Just tested and am all set, much appreciated! It behaves exactly the same, expect now i have the “recommendation” in the Results log and summary email!

 

 

Userlevel 7
Badge +6

@peter-humanfuel - good to hear! congrats!

 

 

Userlevel 7
Badge +5

Wow, congrats to you @peter-humanfuel for setting this up and for @john.desborough for your always amazing advices! 

By the way, why don't you share your form with us, Peter? We'd love to see the result of all of this work! 😊

Userlevel 2
Badge

This is it, take a look @john.desborough and @Gabi Amaral 

It follows a proprietary interna algorithm for recommending one of 12 IV vitamin solutions based on symptoms, future plans, and goals. Feel free to play around - this link has submissions disabled…

 

 

Reply