title: How can I map each specific row value to an ID in Pentaho?
body: <p>I’m new to Pentaho and I’m currently having an issue with mapping specific row values to an ID.</p>
  
  <p>I have a data file with around 30 columns, one of which is for currencies (USD, GBP, AUD, etc).
  The main objective is to have the user select up to 8 (minimum of 1) currencies and map them to a corresponding ID 1-8. All other currencies not in the specified 8 will be mapped with an ID of 9.
  The final step is to then output the original data set, along with the IDs.</p>
  
  <p>I’m pretty sure I’m making this way harder than it should, but here is what I have at the moment.</p>
  
  <p>I have created a job where the first step is to set the variables for my 8 currencies, selectionOne -> AUD, selectionTwo -> GBP, …, selectionEight -> JPY.</p>
  
  <p>I then have a transformation to read the data from the file and use the copy rows to result step.</p>
  
  <p>Following that I have a second job called for-each which is my loop for checking the current currency in the row.
  Within this job I have two transformations, one called <strong>set-current</strong>, one called <strong>map-currencies</strong>.</p>
  
  <p>set-current simply uses the get rows from result step (to grab the data from the first transformation). I then use the set variable step to set the <strong>current</strong> currency to the value in currency field. This works fine, as each pass through in the loop changes the current variable to the correct value.</p>
  
  <p>Map-currencies is where I’m having the most issues.
  The goal is to use the filter row step to compare the current currency against the original 8 selected currencies, and then using the value mapper step to map it to an ID, before outputting the csv file.</p>
  
  <p>The main issue here, is that I can’t use my original variables in the filter or value mapper.
  So, what I’ve done here is use the get variables step to retrieve the variables and named them: one, two, three, …, eight. This allows me to bypass the filtering issue, but they don’t seem to work for the value mapper, which is the all important step.</p>
  
  <p>The second issue is that when the file is output it only outputs one value (because of the loop), selecting the append option works, but this could be a problem if the job is run more than once.
  However, the priority here is the mapping issue.</p>
  
  <p>I understand that this is rather long, and perhaps a tad confusing, but I will greatly appreciate any help on this, even if it’s an entirely new approach .</p>
  
  <p>Like I said, I’m probably making it harder than it should be.</p>
  
  <p>Thanks for your time.</p>
  
  <p>Edit for AlainD</p>
  
  <p><a href="https://i.stack.imgur.com/afgQu.png" rel="nofollow noreferrer">Input example</a></p>
  
  <p><a href="https://i.stack.imgur.com/8nPTC.png" rel="nofollow noreferrer">Output example</a></p>