Select to view content in your preferred language

If Statement for text type question not working

428
8
Jump to solution
07-02-2025 06:26 AM
anonymous55
Frequent Contributor

Hello everyone,

I have a table, and I'm trying to save the result of the user type into a variable called user_type_result. However, my if statement doesn't seem to be working correctly when checking user_type_result.

I've been trying to figure out what’s wrong but haven’t had any luck. Any help would be greatly appreciated!

Thanks in advance.

if(${no_user_type_required} = 'No user type required', 'No user type required',
  if(${you_need_the_viewer_usertype} = 'You need the Viewer Usertype', 'You need the Viewer Usertype',
    if(${you_need_the_contributor_userty} = 'You need the Contributor Usertype', 'You need the Contributor Usertype',
      if(${you_need_the_mobile_worker_user} = 'You need the Mobile Worker Usertype', 'You need the Mobile Worker Usertype',
        if(${you_need_the_creator_usertype} = 'You need the Creator Usertype', 'You need the Creator Usertype',
          if(${you_need_the_professional_usert} = 'You need the Professional Usertype', 'You need the Professional Usertype',
            if(${you_need_the_professional_plus} = 'You need the Professional Plus Usertype', 'You need the Professional Plus Usertype',
              '')))))))



textno_user_type_requiredNo user type required
textyou_need_the_viewer_usertypeYou need the Viewer Usertype
textyou_need_the_contributor_usertyYou need the Contributor Usertype
textyou_need_the_mobile_worker_userYou need the Mobile Worker Usertype
textyou_need_the_creator_usertypeYou need the Creator Usertype
textyou_need_the_professional_usertYou need the Professional Usertype
textyou_need_the_professional_plusYou need the Professional Plus Usertype
   
textuser_type_resultuser type result
Tags (1)
0 Kudos
1 Solution

Accepted Solutions
Neal_t_k
Frequent Contributor

You have a complicated relevant calcs, It might be able to be simplified...but without doing that the easiest would be to set defaults 

NealKittelson_0-1751466159938.png

 

View solution in original post

8 Replies
RyanUthoff
MVP Regular Contributor

What exactly is the problem? I created a quick survey with your if statement and it calculated correctly, as long as the text value of your questions match the if statement, then it correctly calculated the user_type_result for me.

0 Kudos
anonymous55
Frequent Contributor

@RyanUthoff Thanks for reply but I tried with my form and not working. I attached my xls form here maybe I have relevant for some fields

0 Kudos
Neal_t_k
Frequent Contributor

Unless there are some calculations or default answers we are not seeing here, how are you ensuring the user inputs the exact answer the if statements are looking for?  Text questions are a open ended and except any input. So an extra space or misspelling will break your statement.

Have you considered a select_one for some of those questions to force the answers you expect in your if statements.

It might be beneficial to see how your asking these questions in the form, to provide a better answer, can you share this portion of your xlsx or at a screen shot of how the questions appear in your form?

0 Kudos
Neal_t_k
Frequent Contributor

So after reviewing your xlsx, you are not calculating an answer for any of your questions.  You have the label and the hint as your "answer".  You need to calculate (or set as default) the answers you are expecting for your result calculation to work.

NealKittelson_0-1751465168776.png

 

0 Kudos
anonymous55
Frequent Contributor

@Neal_t_k Thanks for respond. yeah I notice that the problem is that. I don't know how to do it. lol.
I created another field user_type_result which has if statement on it but I can't get answer to this field and save it.

0 Kudos
Neal_t_k
Frequent Contributor

You have a complicated relevant calcs, It might be able to be simplified...but without doing that the easiest would be to set defaults 

NealKittelson_0-1751466159938.png

 

anonymous55
Frequent Contributor

@Neal_t_k Thank you so much your solution is working. 

0 Kudos
Neal_t_k
Frequent Contributor

Glad that is working, just a heads up, you have some of your relevant calcs that don't provide a user type or meet the requirements for a more advance license but give a lesser license, for example  You may want to get rid of the count-selected here: 

 

NealKittelson_0-1751468416967.png

You already are require 5 specific answers, but if you answer those 5 and plus another one, you get either nothing or just "Professional".  If those 5 are checked no matter what you should get "Plus".

Also something is overriding the "Plus" with the first answer.

NealKittelson_3-1751468823948.png

I guess just make sure you relevant calcs give you what you are expecting.

 

  

 

0 Kudos