14 Replies Latest reply: May 12, 2015 6:31 AM by Sunny Talwar

# variables matching

Hi,

hopefully a very simple problem:

I have different variables with values from 1 to 5, and want to generate one variable out of that who only countes the ones:

V1 (5x1,10x2, 4x3,...)

V2 (6x1, 0x2, 3x3,...)

V3 (12x1, 3x2, 3x3, ...)

...

new Variable V (5xV1, 6xV2, 12xV3, ...)

Can anyone help?

Thanks a lot and regards

Alex

• ###### Re: variables matching

Not sure what your requirement is. Can you elaborate?

V1, V2 and V3 are the names of your variable here???? and your new variable needs to show 5xV1? not sure I understand if x is x or Multiplication sign??

• ###### Re: variables matching

Sorry for the misunderstanding, X means the multiplication sign and the new Variable has to show (5,6,12,...) as V1 has five times a 1, V2 has 6 times a 1, V3 has 12 times a 1 and so one. Hoping that makes it more clear... Thanks!

• ###### Re: variables matching

And one more question: How is your variable V1 set up right now?

V1 = 1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,3,3,3,3,... or is it the way you have specified 5x1, 10x2, 4x3??

I am just trying to understand the structure, before I can think of how it can be done.

• ###### Re: variables matching

The variables V1 etc. are build of single answers, so for example 1,2,3,2,1,2,2,2,1,2,3,4,...

• ###### Re: variables matching

Try this:

v1 = '1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,3,3,3,3'

v2 = '1,1,1,1,1,1,3,3,3'

v3 = '1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,3,3,3'

NewV =

=Count(If(SubField(\$(v1), ',', ValueLoop(1, 1000,1)) = 1, SubField(\$(v1), ',', ValueLoop(1, 1000,1)))) & 'xV1 ,' &

Count(If(SubField(\$(v2), ',', ValueLoop(1, 1000,1)) = 1, SubField(\$(v2), ',', ValueLoop(1, 1000,1)))) & 'xV2 ,' &

Count(If(SubField(\$(v3), ',', ValueLoop(1, 1000,1)) = 1, SubField(\$(v3), ',', ValueLoop(1, 1000,1)))) & 'xV3'

Also find attached the application for your reference.

HTH

Best,

Sunny

• ###### Re: variables matching

Hi sunny, thanks so far, we're on a good way, but I think its easier if we make it more visual so I also attached an application...

As you can see there are in total 9 variables @q031 to @q039 which can be charted separately. My goal is to chart them in one file so that there are 9 bars side by side as in the lower chart shown. How can I get to this dimension?

Thanks a lot

Alex

• ###### Re: variables matching

Are you trying to plot 1's on a bar graph for each field?

• ###### Re: variables matching

Yes, the graph should the amount of 1's of each of the nine variables. (first bar 2736, second bar 1526 and so on...)

• ###### Re: variables matching

Damn man, something isn't right about the application you have shared, I make a change and it takes 10 mins to show me the change. Do you know why it's doing that?

Sunny

• ###### Re: variables matching

Have a look at the attached, is this what you are looking for?

Best,

Sunny

• ###### Re: variables matching

Thats exactly what I was looking for!

Don't know exactly by now, how you done that and also on my site it takes a lot of time to upload the cahnges but thank you very much for the support!!!

• ###### Re: variables matching

Not a problem. I am glad I was able to help

Best,

Sunny

• ###### Re: variables matching

Instead of variable you can create evaluate function

where exp =3*2

evaluate (3*2) returns 6

• ###### Re: variables matching

thanks, but I think I have more to look at the variables than at the answers.

maybe with commands like join, match or something in this direction...