Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
mostal75
Contributor III
Contributor III

Extract values in special fields

Hello,

I need your help to manage special case found.

In database my field store numbers like 1, 2, 33, 1027.....

In fact, each 2^x represent specific value.

For example:

2^0=1 --> blue car

2^1=2 --> red car

2^2=4 --> orange car

.....

For a customer, this field stores any cars they have. If they have a blue car, value is simple: 1. If a customer have 2 cars, the value is the sum of the two values (example: 6 for a red and orange car). I have lots of combination so it seems impossible to create a pick/match function.

Do you have any idea to extract each single result (cars) in this example please ?

Regards

Regis

Labels (2)
1 Solution

Accepted Solutions
mostal75
Contributor III
Contributor III
Author

Sounds grenat
Thanks a lot

View solution in original post

13 Replies
dplr-rn
Partner - Master III
Partner - Master III

Not 100 % clear. i am assuming you get x (in the 2^x) from your data.
Did you try creating a map and applymap for blue/orange thing
sunny_talwar

So, if a customer has a value of 4... does it mean that he has  3 cars (2 blue and 1 red) or 2 cars (2 red) or 1 car (1 orange)? if the value is summed, how will you differentiate?

mostal75
Contributor III
Contributor III
Author

that's not possible with map/applymap because when 2 values summed in the field the maping can't match each individual values

 

Example:

red car =1

blue car=2

myfield value is 3 and i need to retrieve the two values 

mostal75
Contributor III
Contributor III
Author

Sunny_talwar, thanks for your help
Hopefully we only have an value maximum by type
If we have 3 cars there's only 1 of each color
For this example: 3 cars (red=2^0=1, orange=2^1=2, green=2^2=4) my fiedl value will be 4+2+1=7
sunny_talwar

Are you saying that you would know in advance how many cars each one of them have?

mostal75
Contributor III
Contributor III
Author

In fact, with the field value, I need to extract which car the person have
value 7 -> 3 cars: 1 red, 1 orange, 1 green
value 1 -> 1 car: 1 red
sunny_talwar

But value 7 can also mean 4 cars = 1 orange and 3 blue cars, isn't it?

sunny_talwar

I guess if I see a value, how do I know what makes it up... is it 4+2+1 or is it 4+1+1+1 or 2+2+2+1 or 2+1+1+1+1+1?

mostal75
Contributor III
Contributor III
Author

Hopefully not 🙂
Only 1 color by car in a field line