2 Replies Latest reply: Feb 13, 2015 4:31 AM by Friedrich Hofmann RSS

    Fields from base_file with BLANKs - in brackets?

    Friedrich Hofmann


      Hi,

       

      in my underlying Excel_file there are fields with blanks in the field_name. Currently, for instance, there is "Betriebsstunden Dezember 2014" and "Betriebsstunden Januar 2015".

      For various reasons, I load it all at first and use the Fieldname() function to find out the field_names. The names of these two fields appear in the Debugger in brackets as I would expect, as "[Betriebsstunden Dezember 2014]" and so on.

      Now, however, I have the challenge that every month from now, one column will be added:

      => In March, there will be a third column "Betriebsstunden Februar 2015" and so forth.

      I have copied the original file to test a loop parsing all fields to the right of the "current" one and find out if their names begin with "Betriebsstunden".

      The issue is, in the Debugger, when I test this loop (and I have one column "Betriebsstunden Februar 2015", it appears without brackets and so, if I want it to become "BS_Feb_15", I have to cut off the last 2 numbers from the year.

      <=> If that were to appear with brackets, that would be wrong, I would need to cut the first 2 of the last 3 in that case.

       

      => Can anyone help me there? Why does the field appear without brackets in the loop?

       

      The essential bit of code is this:

      >>  IF Subfield(Fieldname($(i), 'Staplerkosten_pre'), ' ', 1) = 'Betriebsstunden' THEN
               LET v_VarValue2 = 'BS_'& LEFT(SubField(Fieldname($(i), 'Staplerkosten_pre'), ' ', 2), 3) & '_' & RIGHT(SubField(Fieldname  ($(i), 'Staplerkosten_pre'), ' ', 3), 2);

      <<

      (of course this IF_THEN_loop is closed properly. The code works, I am just not sure if I should use the last 2 or 3 numbers from the fieldname)

       

      Thanks a lot!

      Best regards,

       

      DataNibbler