Inserting commas in a list

Below is the list I have created. I would like to add commas between each parameter.

The list is written like this because this is the order in which the parameters need to occur. However, I can't simply add the comma's into the IIf functions since not all parameters are analysed in every sample. Eg sample is analysed for BTEX, F1-F4, Pb or PAH only.

 

<<ListBuildSepTrim(_

   <<cr>>,_

      <<IIf(<<TESTS.BTEX>>, BTEX,)>>_

      <<IIf(<<TESTS.BTEXH>>, BTEXH,)>>_

      <<IIf(<<TESTS.VOC>>, VOC,)>>_

      <<IIf(<<TESTS.CVOC>>, CVOC,)>>_

      <<IIf(<<TESTS.12-DCA EDB MTBE>>, "1,2-DCA, EDB, MTBE",)>>_

      <<IIf(<<TESTS.Selected VOC>>, Selected VOC,)>>_

      <<IIf(<<TESTS.F1-F4>>, F1-F4,)>>_

      <<IIf(<<TESTS.PAH>>, PAH,)>>_

      <<IIf(<<TESTS.2 & 3 Ring PAH>>, 2 & 3 Ring PAH,)>>_

      <<IIf(<<TESTS.SVOC>>, SVOC,)>>_

      <<IIf(<<TESTS.Selected PAH>>, Selected PAH,)>>_

      <<IIf(<<TESTS.Metals>>, Metals,)>>_

      <<IIf(<<TESTS.Pb>>, Pb,)>>_

      <<IIf(<<TESTS.6 Metals>>, 6 Metals,)>>_

      <<IIf(<<TESTS.Selected Metals>>, Selected Metals,)>>_

      <<IIf(<<TESTS.PCB>>, PCB,)>>_

      <<IIf(<<TESTS.Pesticides>>, Pesticides,)>>_

      <<IIf(<<TESTS.Grain Size>>, Grain Size,)>>_

      <<HasData(<<TESTS.Additional Parameters>>,<<TESTS.Additional Parameters>>,)>>_

)>>

 

Any suggestions?

  • D., the ListBuildSepTrim() function already has this capability - instead of the separator being <<cr>> to add a line feed, it sounds like you want a comma to be expressed at the end of each test line (followed by a line feed). So you make that part of your separator expression:

    <<ListBuildSepTrim(_
       ","<<cr>>,_
          <<IIf(<<TESTS.BTEX>>, BTEX,)>>_
          <<IIf(<<TESTS.BTEXH>>, BTEXH,)>>_
    ...

    The embedded comma needs to be in quotes, as otherwise gINT will assume it is the first comma in the function.

    This will work to place a comma plus a line feed as a separator between each list item that returns data and the next.

    See the gINT Help topics Functions Overview and ListBuildSepTrim (function).