xFilesTree - example using definition with included queues

I used the Capesoft Code Gen to create a Clarion definition from XML data provided.
The definition includes defined queues.
Is there an example of how to manipulate those queue?
They are part of nested groups and I can’t seem to get the syntax correct.

A little fuzzy as to what you are asking w/o an example but the 3 steps are

  1. Load the XML into your clarion structures
  2. Manipulate the data as you would in normal clarion code
  3. Save the clarion structure back into XML
1 Like

For some types of structures, the compiler (or whatever you call the thing that does this :slight_smile: ) gets confused when you try to reference the entire thing.

In those cases, sometimes it helps to assign sub-parent structures to a reference. Then try manipulating whatever is in the reference.

e.g. some pseudo-code here:

MyBigStructure  LIKE(MyBigStructureType)
MySubStructure &MySubStructureType

  CODE

  MySubStructure &= MyBigStructure.SomeSubStructure

  MySubStructure.Whatever = Whatever

1 Like

Okay, having some luck now but trying to figure this one out…

Here’s the code:

ReportTotals     Group,Name('ReportTotals')
AllTotalsGroup       Group,Name('AllTotalsGroup')
Sales                                                    Real,Name('Sales')
Tax                                         Real,Name('Tax')
                                 End
ProductTotalsGrp   &ProductTotalGrpQueueType,Name('ReportTotals | queue | RowName(ProductTotalsGrp)')
                               End



ProductTotalGrpQueueType   Queue,Type,Name('ReportTotals | RowName(ProductTotalsGrp)')
ProductCode                    STRING(255),Name('ProductCode')
ProductSales                                    Real,Name('ProductSales')
ProductTax                                         Real,Name('ProductTax')
                                 End

Expected Results: Under Report Totals there is an ALL and then one Product for each product (this is the Queue)

         <ReportTotals>
                  <AllTotalsGroup>
                     <Sales>38000.92</Sales>
                     <Tax>2000.00</Tax>
                    </AllTotalsGroup>
                    <ProductTotalsGrp>
                    <ProductCode>ABC</ProductCode>
                     <ProductSales>10000.00</ProductSales>
                     <ProductTax>2000.00</ProductTax>
                     </ProductTotalsGrp>
                      <ProductTotalsGrp>
                       <ProductCode>XYZ</ProductCode>
                       <ProductSales>12000.00</ProductSales>
                        <ProductTax>2000.00</ProductTax>
                      </ProductTotalsGrp>
                 </ReportTotals>

Actual Results: I can’t get it to NOT repeat ‘Report Totals’ when building the Queue section.
I’ve tried reversing them, but then it just creates ProductTotalGrp → ReportTotals…

      <ReportTotals>
                <AllTotalsGroup>
                                <Sales>38000.92</Sales>
                                <Tax>2000.00</Tax>
                </AllTotalsGroup>
        <ReportTotals>
          <ProductTotalsGrp>
                                <ProductCode>ABC</ProductCode>
                                <ProductSales>10000.00</ProductSales>
                                <ProductTax>2000.00</ProductTax>
          </ProductTotalsGrp>
          <ProductTotalsGrp>
                                <ProductCode>XYZ</ProductCode>
                                <ProductSales>12000.00</ProductSales>
                                <ProductTax>2000.00</ProductTax>
          </ProductTotalsGrp>
        </ReportTotals>
      </ReportTotals>

Any ideas / suggestions?

Found the solution:

Needs to be:

ProductTotalsGrp &ProductTotalGrpQueueType,Name(‘ReportTotals | queue | xmlName() | RowName(ProductTotalsGrp)’)

1 Like