Selection and replacement problem
Hi all,
The problem I am trying to solve is as follows.
I have an attribute (A1) with a range of values [4rf, 56X, 78t...]
The values of (A1) are also attributes in themselves in the same example set. (A4rf), (A56X), (A78t).
For each row I want to select the corresponding attribute to the one in (A1) and replace the value of the corrsponding attribute with a given value.
I found a solution to doing this with lots of filters and the replace operator but it seems like a lon winded and very un-elegant solution.
Do you have a better way to do this?
Many thanks,
Jamie
Answers
-
Do you want to post your existing solution process and/or a sample data file for others to use as a starting point? That is usually helpful for other community members.
My initial diagnosis is that a Join to create a new attribute from the original values via a lookup table, followed by a Pivot, should do the trick, but a sample data file will be helpful to demonstrate.1 -
Hi Brian,
Many thanks for responding -
Creating a new attribute isn't necessary, it already exists. I wish to populate it with a spcified value for the given clause below.
Here is a conceptual view of my data. (although the total number of attributes is 120)
A1 - A2 - A3 - A4
x1 - y1 - z1 - A1
x2 - y6 - z4 - A1
x7 - y3 - z5 - A2
x4 - y4 - z4 - A3
where A4 = value An
replace value of attribute An with a given value.
So if the given value is "sheepskin" the data would look like this:
A1 - A2 - A3 - A4
sheepskin - y1 - z1 - A1
sheepskin - y6 - z4 - A1
x7 - sheepskin - z5 - A2
x4 - y4 - sheepskin - A3
Hope that makes things clearer!
0 -
I'm afraid you lost me with the example
If I understood correctly, then first attribute has as values the names of the attributes to replace. For example:
x A1 A2 A3 A4
A1 x y z p
A2 a b c dwith given value of xXx
will turn to
x A1 A2 A3 A4
A1 xXx y z p
A2 a xXx c d0 -
Sorry, you have definitely lost me here.
0