Do nothing as part of expression

Do nothing as part of expression

Oct 24, 2019
Andy Perry wrote
Hi, i am trying to import some data from an XML file exported from sage accounts.

i have transformed my xml to csv through the import wizard so i now have 3 columns, SKU - PRICE - PRICEBAND

the problem is my xml contains seperate nodes for each priceband so my converted csv has the SKU repeated for each priceband along with the price

our xml file contains price bands for products looks something like:


Standard
Standard
SKU001
17.49000


Trade
Trade
SKU001
12.00000



Standard
Standard
SKU002
7.99000


Trade
Trade
SKU002
2.99000



using the following expressions i can import the standard price into into the correct database field
IF ([CSV_COL(3)] = "Standard", [CSV_COL(2)],0)
IF ([CSV_COL(3)] = "Trade", [CSV_COL(2)],0)

but when I then import the second row in the csv trade price (same SKU) the standard price gets overwritten with a zero - i understand that the if statement returned false so now outputs 0 rather than col(2). i dont want to output zero on false i would like to do nothing in this case. so that my previous standard price is not overwritten with 0 - i've tried removing the 0 from the expression but get an sql syntax error

is there a way of doing nothing on return false from the if condition, or alternatively is it possible to write the existing value back to the database here ie if the value already stored in the DB is 1.99 then read this & then write it back as part of the expression - i realise this will be a semantically null statement but will allow me to complete the expression syntax correctly while achieving the required result.

our xml file contains price bands for products looks something like:


Standard
Standard
SKU001
17.49000


Trade
Trade
SKU001
12.00000



Standard
Standard
SKU002
7.99000


Trade
Trade
SKU002
2.99000



Hope someone can help me out here, it's been driving me nuts all morning
Reply
1 Answer
Avatar image
Oct 24, 2019
Yana Kostyk agent wrote
As solution you can import Trade price and Standard price via sepeare imports applying expressions to the SKU field for each import.
If you need our further assistance please contact us via email with your import files > https://www.mag-manager.com/contact-us/