Before opening a new ticket, please verify SureDone status at https://status.suredone.com and also review our helpful articles below.

Start a new topic
Answered

Automation - one file several brands


We have an inventory file where we do not receive the UPCs.


See example below:


item brand availible_today

TST4HP ACCEL 12

TST6 ACCEL 13

TST7 ACCEL 27

1002M ACCEL Motorcycle 11

111129 ACCEL Motorcycle 42

111130 ACCEL Motorcycle 115

111131 ACCEL Motorcycle 321

400AOR Anvil 4

4500AOR Anvil 9

4511AOR Anvil 43

4520AOR Anvil 13

500AOR Anvil 0

505AOR Anvil 6

9520AOR Anvil 4

9521AOR Anvil 8

A1000002 APR 64

A1000004 APR 30

A1000005 APR 28

APR19A-N20 APR 0

APR19S-M93-L APR 0

APR19S-M93-M APR 0

BRK00001 APR 0

10025 B&M 0

102002 B&M 2

10225 B&M 0

10226 B&M 0

10227 B&M 0

81232 XDR 14

81233 XDR 14


We would like to use the guid as an identifier but we would have to replace the values in the brand column with the corresponding AAIA BRAND ID.


Example of the 1st row:

item  brand  availible_today

TST4HP ACCEL 12


ACCEL would have to be  replaced with BDDP


so the guid = BDDPTST4HP 


Do we need to call this? Can you give us a working example?


 "replace": object: {key=field to apply function to: {key=value to search for: value to replace with}}

 


Best Answer

Hey Erno, for a case like this, it's probably best to just use "value_map", in which the values on the left are replaced by those on the right. Example:

"value_map": {
"ACCEL": "BDDP",
"some brand value": "some AAIA BRAND ID",
...
}


"replace" is useful for matching on "substrings", but you need to be careful, for example:

"vendor_actions": [
    {
       "replace": {
         "brand": {
              "ACCEL": "BDDP"
             }
        }
    }
]


So if you had a brand that came in as, for example, "ACCELONE", this would become "BDDPONE", which may or may not be desired, whereas "value_map" provides only an exact match-type replacement, so ACCELONE would remain as ACCELONE.

Both will work though if you have an expected set of finite values.

Hope this helps and let us know if you have any further questions!

1 Comment

Answer

Hey Erno, for a case like this, it's probably best to just use "value_map", in which the values on the left are replaced by those on the right. Example:

"value_map": {
"ACCEL": "BDDP",
"some brand value": "some AAIA BRAND ID",
...
}


"replace" is useful for matching on "substrings", but you need to be careful, for example:

"vendor_actions": [
    {
       "replace": {
         "brand": {
              "ACCEL": "BDDP"
             }
        }
    }
]


So if you had a brand that came in as, for example, "ACCELONE", this would become "BDDPONE", which may or may not be desired, whereas "value_map" provides only an exact match-type replacement, so ACCELONE would remain as ACCELONE.

Both will work though if you have an expected set of finite values.

Hope this helps and let us know if you have any further questions!


1 person likes this
Login or Signup to post a comment