# Relevance equation - Date higher than X & Question Answer is Y

1 Jahr 5 Monate her #164554
In another topic I got help so that I can show a question of the installation date is within 60 days. Problem is I have another criteria for this question, if Manufacturer is Y then it is only 30 days instead of 60 like everyone else.

When I add the Relevance equation it works fine, but the issue is that if the date is within 30 days, it displays both questions. When I add a condition manually to say Question X's answer has to equal to Y. It will overwrite my below date check. Is it possible to add an IF to the below so that it works? Or how can I do it?

60 Days
(strtotime(date('Y-m-d'))-strtotime(INSERTANS:669123X301X2381)) >= (60*60*24*60)

30 Days
(strtotime(date('Y-m-d'))-strtotime(INSERTANS:669123X301X2381)) >= (60*60*24*30)

Thanks

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

LimeSurvey Partners
1 Jahr 5 Monate her #164561 von tpartner
Assign the 30/60 number in another equation question (lets call it "warrantyPeriod") and the reference that in your relevance equation.

`(strtotime(date('Y-m-d'))-strtotime(INSERTANS:669123X301X2381)) >= (60*60*24*warrantyPeriod)`

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

1 Jahr 5 Monate her #164572
Not sure im following.

I have a question called warranty type with 3 answer options. Commissioning, Parts only, Parts Labour & Travel.

There is another question with different Manufacturers listed.

If Commissioning and X OEM is selected I need 30 days, all others are 60 days.

How do I make a new question so that I can reference the 30/60 as you mentioned?

Thanks

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

1 Jahr 5 Monate her #164579 von tpartner
It's impossible for me to give an equation code example without knowing your survey set-up and question/answer codes but here is a sample survey that should give you the idea.

Selecting the first option in Q1 and Q2 will result in a warranty period of 30 days, all other combination of selections result in 60 days.

#### Dateianhang:

Dateiname: limesurvey...6928.lss
Dateigröße:16 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
##### Anhänge:

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

1 Jahr 5 Monate her #164580 von Joffm

If Commissioning and X OEM is selected I need 30 days, all others are 60 days.

Then you create an equation (lets call it "warrantyPeriod") like

{if (manufacturer=="X OEM",30,60)}

Afterwards you can use this variable.

Regards
Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

1 Jahr 5 Monate her #164582
The survey is somewhat more complicated than that. If you could have a look at the attached, that is basically what I need working.

Q1 = warranty type

Q2 = OEM (although on the real survey this is 3 separate question, one for each warranty type)

Then I have 4 text display options, depending on what was selected as the text needs to be different for each.

Now the issue is I have is that it displays the other 3 text displays no matter what date option is selected. The corresponding text display is hidden is the date is within the 60 days.

Any idea what I am doing incorrectly?

#### Dateianhang:

Dateiname: limesurvey...9282.lss
Dateigröße:25 KB
##### Anhänge:

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

1 Jahr 5 Monate her - 1 Jahr 5 Monate her #164584 von Joffm
Hi,
set the relevance of Q3, Q4,... not only to "equationX" but to "equationX!=0" (or "equationX==1").

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Letzte Änderung: 1 Jahr 5 Monate her von Joffm.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

1 Jahr 5 Monate her #164588
Great stuff! Works great.

One more thing, now I have a question group that is empty if the date is correct. Is it possible to skip/hide question groups where all answers are hidden?

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

1 Jahr 5 Monate her - 1 Jahr 5 Monate her #164595 von Joffm
Just set the relevance of the group.
Should be something like:
(equation1==1) or (equation2==1) or ...

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Letzte Änderung: 1 Jahr 5 Monate her von Joffm.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

1 Jahr 5 Monate her #164598
Cheers mate, you guys are the best

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

## Jetzt loslegen!

#### Melden Sie sich jetzt an, und erstellen Sie in wenigen Minuten Ihre erste Umfrage.

Abonnieren Sie unseren Newsletter für alle Neuigkeiten rund um LimeSurvey