You cannot use DIM() fields in a Queue that feeds a LIST. As you saw you get an error at runtime.
The more difficult workaround is to use a VLB (aka Virtual List Box or VLBProc) where you supply a callback that can supply the data using any Queue, File or method. VLB’s work very well.
The simplest workaround is to use OVER() like:
TestQueue Queue(),Pre()
Name String(20)
DimStr_1 String(20) !was DimStr String(20),Dim(20)
DimStr_2 String(20) !now have 20 STRING(20) fields
... 3 - 18 ...
DimStr_19 String(20)
DimStr_20 String(20)
End
DimTestQueue GROUP(),Pre(DimTestQ) ,OVER(TestQueue)
Name String(20)
DimStr String(20),Dim(20)
End
You can have a GROUP in the Queue which is nice so you just Over the Array. But you must count that Group as a Field and skip that Field in your Format using #Field#. Not sure if that can work with a Browse template.
TestQueue Queue(),Pre()
Name String(20)
DimStr_Group GROUP,PRE() !Will be Field #2#
DimStr_1 String(20) !Will be Field #3#
DimStr_2 String(20)
... 3 - 18 ...
DimStr_19 String(20)
DimStr_20 String(20)
End !Group
End
DimStr String(20),Dim(20) , OVER(DimStr_Group)
My LIST Format Tool can be helpful. You can paste in any FORMAT() string and it will preview a working LIST fed by test data using VLB.
The Browse Template makes its own Queue that will not have DIM fields, it will just have the Subscript(s) you picked.