Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Lewi2763
Contributor II
Contributor II

Using one variable to set the value for another variable

I dont know if anyone can help me with a problem I have .

On a sheet I have 4 filter panes and 3 tables. 2 of the tables are on one alternate state and the third on a separate one. The reason for this is when I search, in most cases it will be a serial number, it only returns one row. On that row there is a registration number that can have several serial numbers assigned to it but only the filtered one will be displayed. I want to display all the serials assigned to that registration number. The main problem is that the registration number will be unknown at the time of searching otherwise I could just filter by that. Normally only the serial number is known. I want to use the registration number to act as the filter in the third table. What I need to have is the variable from one state to set the value for a different alternate state. i am not 100% sure this is possible.

The variables are  vReg_Pack wit ha definition of =REG_PK. This works fine.

and

vRegistration_Pack with a definition of =$({Reg Pack}REG_PK) but I think this is probably the wrong definition 

what I need is for  vReg_Pack  to equal vRegistration_Pack or  the other way round

Any help will be greatly appreciated

Labels (1)
1 Solution

Accepted Solutions
Lewi2763
Contributor II
Contributor II
Author

i think they will have to do it manually. They can search for the serial number then take the reg number and enter that into the filter pane. Its not that much of an issue. I was just trying to make things easier for them.

Thanks for the help

View solution in original post

9 Replies
vincent_ardiet_
Specialist
Specialist

You can try with something like
=Only({Reg Pack}REG_PK)

Lewi2763
Contributor II
Contributor II
Author

No that didn't work. Tried using in the  expression and the variable separately but both returned the error of "Error in expression'}' expected".  Tried copying as well as typing it out.

vincent_ardiet_
Specialist
Specialist

Yes, sorry, as there is a space in the name of your alternate state you have to use brackets or double quotes:
=Only({[Reg Pack]}REG_PK)

Lewi2763
Contributor II
Contributor II
Author

Thanks. that probably explains a lot of the issues i have seen.

Lewi2763
Contributor II
Contributor II
Author

i think they will have to do it manually. They can search for the serial number then take the reg number and enter that into the filter pane. Its not that much of an issue. I was just trying to make things easier for them.

Thanks for the help

Lewi2763
Contributor II
Contributor II
Author

i have revisited this issue and I have got an expression that works but very strangely only once. The expression is =if({inherited} vReg_Pack = {[Reg Pack]}REG_PK,{[Reg Pack]}REG_PK).  What it does is takes the variable vReg_Pack from the alternate state "inherited". It then compares that value to the values in the REG_PK column in the other alternate state " Reg Pack "and if it matches it then displays it in the table in the alternate state 2Reg Pack". When I enter the expression and click apply it applies the expression and filters the table correctly. The problem is when I change the serial number the table stays the same even though the variable vReg_Pack changes. Even stranger if I go back into the expression and edit it and then apply it again it will work. Is there a command I am missing that sort of retriggers the expression or something

Thanks for any ideas

vincent_ardiet_
Specialist
Specialist

Try like this, I've noticed in the past that sometimes QS is not updating variables but using the variable expansion syntax works better:
=if($(={inherited} vReg_Pack) = $(={[Reg Pack]}REG_PK),$(={[Reg Pack]}REG_PK))
or if the variables are strings
=if('$(={inherited} vReg_Pack)' = '$(={[Reg Pack]}REG_PK)','$(={[Reg Pack]}REG_PK)')

Lewi2763
Contributor II
Contributor II
Author

i tried that but got the message below

Lewi2763_0-1700563780174.png

I counted the brackets and they match

Lewi2763
Contributor II
Contributor II
Author

the string one didn't return an error but it also didn't return any data