Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

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

1 Solution

Accepted Solutions
sunny_talwar

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

Best,

Sunny

View solution in original post

14 Replies
sunny_talwar

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??

Not applicable
Author

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!

sunny_talwar

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.

sunilkumarqv
Specialist II
Specialist II

Instead of variable you can create evaluate function

where exp =3*2

evaluate (3*2) returns 6

Not applicable
Author

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

Not applicable
Author

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...

sunny_talwar

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

Not applicable
Author

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

sunny_talwar

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