# xFilesTree - example using definition with included queues

**URL:** <https://clarionhub.com/t/xfilestree-example-using-definition-with-included-queues/7592>\
**Category:** questions\
**Tags:** xfiles, xml\
**Created:** [October 22, 2024, 8:33am UTC](https://clarionhub.com/t/xfilestree-example-using-definition-with-included-queues/7592 "2024-10-22T08:33:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![PaulMacFarlane](https://clarionhub.com/user_avatar/clarionhub.com/paulmacfarlane/32/4804_2.png) [@PaulMacFarlane](https://clarionhub.com/u/PaulMacFarlane)\
**Post date:** [October 22, 2024, 8:33am UTC](https://clarionhub.com/t/xfilestree-example-using-definition-with-included-queues/7592/1 "2024-10-22T08:33:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![KevinErskine](https://clarionhub.com/user_avatar/clarionhub.com/kevinerskine/32/711_2.png) [@KevinErskine](https://clarionhub.com/u/KevinErskine)\
**Post date:** [October 22, 2024, 9:49pm UTC](https://clarionhub.com/t/xfilestree-example-using-definition-with-included-queues/7592/2 "2024-10-22T21:49:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jslarve](https://clarionhub.com/letter_avatar_proxy/v4/letter/j/e480ec/32.png) [@jslarve](https://clarionhub.com/u/jslarve)\
**Post date:** [October 22, 2024, 11:12pm UTC](https://clarionhub.com/t/xfilestree-example-using-definition-with-included-queues/7592/3 "2024-10-22T23:12:20Z")

</div>

For some types of structures, the compiler (or whatever you call the thing that does this 🙂 ) 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:

```clarion
MyBigStructure LIKE(MyBigStructureType)
MySubStructure &MySubStructureType

  CODE

  MySubStructure &= MyBigStructure.SomeSubStructure

  MySubStructure.Whatever = Whatever

```

---

<div class="post-metadata">

**Author:** ![PaulMacFarlane](https://clarionhub.com/user_avatar/clarionhub.com/paulmacfarlane/32/4804_2.png) [@PaulMacFarlane](https://clarionhub.com/u/PaulMacFarlane)\
**Post date:** [October 23, 2024, 8:50am UTC](https://clarionhub.com/t/xfilestree-example-using-definition-with-included-queues/7592/4 "2024-10-23T08:50:03Z")

</div>

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

Here’s the code:

```auto
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)

```auto
         <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…

```auto
      <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?

---

<div class="post-metadata">

**Author:** ![PaulMacFarlane](https://clarionhub.com/user_avatar/clarionhub.com/paulmacfarlane/32/4804_2.png) [@PaulMacFarlane](https://clarionhub.com/u/PaulMacFarlane)\
**Post date:** [October 23, 2024, 4:21pm UTC](https://clarionhub.com/t/xfilestree-example-using-definition-with-included-queues/7592/5 "2024-10-23T16:21:10Z")

</div>

Found the solution:

> [@PaulMacFarlane](#):
>
> `ProductTotalsGrp &ProductTotalGrpQueueType,Name('ReportTotals | queue | RowName(ProductTotalsGrp)')`

Needs to be:

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