Working with constraint

Hello everyone,
I have two questions which are all integer and I want to put a constraint such that the answer to the second question should be less or equal that of the first question. For example my question names are p100a_num_child_cpnd and p100b_num_child_hh. I have tried to use data(‘p100b_num_hh’) <= data(‘p100a_num_child_cpnd’) in the constraint column but it does not work. Any help on how I can solve this?

Hi @jaredagia! You’re on the right track with your constraint, a couple of possibilities:
One is that it looks like your ’ are curled, which may be confusing things.
So here’s an example from our code: (data(‘q717’) >= 0 && data(‘q717’) <= 100)
and you can see the quotes are straight lines. I feel like we have occasionally run into issues when they curl/curve.
Another issue sometimes is that if these are on the same screen, until next is pressed they may be both null in the table, so try putting the second question, where you want the constraint, on a second screen and see if that helps.

You can also share your .xlsx for us to take a look if neither of those fixes things.

@elmps2018, thank you,it worked. The questions were on the same screen.

2 Likes