18 Replies Latest reply: Apr 20, 2016 10:07 AM by Rickard Andersson RSS

    Select column based on an if statement - does not work? (excel source)

    Rickard Andersson

      Hi, I got this statement - that checks part of the filename to decide what column name to use importing from sheet

      and save that value into a field with a common name.

       

      However it seems the importer evaluates the existence of BOTH Columns regardless if only one of them is to be used according

      to the IF-statement (that does not check column values but the filename to avoid checking for Columns that does not exist)

       

      If(Trim(Left(SubField(FileName(),'Open',2),8)) = 'Changes',[CHG],[INC]) As State,

       

      ... the problem is only either one or the other column name exists in each source-file, and import fails on the missing column

      even if Iam not actually trying to import it imo.

       

      I thought i could workaround by checking filename and decide what column to import based on that - but it seems I cannot?