7 Replies Latest reply: Nov 22, 2012 9:26 AM by Christian Frenz RSS

    Different behavior of Wildmatch on same rows

      Hi,

       

      I am reading lines from a text file and want to extract some specific data from some rows into different fields. It is working in the DataRaw table.

      To not use Mid(@1, 22) all the time within the string operations esp. if it gets more complicated for the string parts I have to reload the needed field from the DataRaw table into a new table AFAIK.

      But in the DataAnalysis more data is extracted from the line. It looks for me like the Wildmatch is not working properly there.

      Can anyone help me with this issue? Where is my mistake?

       

       

      Thanks

      Christian

       

      DataRaw:
      LOAD DISTINCT
      filename() as source,
      Mid(@1, 22) as line,
      if(Wildmatch(Mid(@1, 22), '*Condition AA*', '*Condition AB*')=1, Replace(Mid(Mid(@1, 22), 30), 'TextA', ''), Replace(Mid(Mid(@1, 22), 56), 'TextB', '')) as Field1,
      if(Wildmatch(Mid(@1, 22), '*Condition BA*')=1, Mid(Mid(@1, 22), 39, 17)) as Field2
      FROM
      [data.txt]
      (txt, codepage is 1252, no labels, delimiter is '\t', msq)
      where wildmatch(@1, '*Textcondition*');
      
      DataAnalysis:
      LOAD DISTINCT
      @1 as raw_line,
      if(Wildmatch(@1, '*Condition AA*', '*Condition AB*')=1, Replace(Mid(@1, 30), 'TextA', ''), Replace(Mid(@1, 56), 'TextB', '')) as Field1a,
      if(Wildmatch(@1, '*Condition BA*')=1, Mid(@1, 39, 17)) as Field2
      FROM_FIELD
      (DataRaw, line)
      (txt, codepage is 1252, no labels, delimiter is '\t', msq);