Pivot - AppDaddy-Software-Solutions-Inc/framework-markup-language GitHub Wiki
The PIVOT
is a child of Datasources, it is useful for manipulating the data to a more singular / understandable format that focuses on 2 fields that share a data point you pivot around.
Currently the {total}, {count}, {average}, {min} and {max} can only be bound to the first column so referencing the column will give you the sum by default.
None
Name | Type | Default | Description | Req |
---|---|---|---|---|
row | string | n/a | Field to build rows from | ✔ |
column | string | n/a | Field to build columns from | ✔ |
field | string | n/a | Field to sum/avg against rows & columns | ✔ |
addsummaryrows | bool | false | If true, 2 rows are added to the end of the data set. Rows "AVG" and "TOTAL" show the columns summary for each | |
addsummarycolumnns | bool | false | If true, 2 columns are added to the end of the data set. Rows "AVG" and "TOTAL" show the rows summary for each |
All examples will use this example data from this Datasource endpoint: api.web/fastfood
Show pre-pivot dataset
<DATA>
<ROW>
<RESTAURANT>McDonalds</RESTAURANT>
<DATE>2021-09-28</DATE>
<AMOUNT>23.45</AMOUNT>
<DRIVETHROUGH>true</DRIVETHROUGH>
</ROW>
<ROW>
<RESTAURANT>BurgerKing</RESTAURANT>
<DATE>2021-09-28</DATE>
<AMOUNT>8.95</AMOUNT>
<DRIVETHROUGH>true</DRIVETHROUGH>
</ROW>
<ROW>
<RESTAURANT>Wendy's</RESTAURANT>
<DATE>2021-09-28</DATE>
<AMOUNT>31.11</AMOUNT>
<DRIVETHROUGH>false</DRIVETHROUGH>
</ROW>
<ROW>
<RESTAURANT>McDonalds</RESTAURANT>
<DATE>2021-09-28</DATE>
<AMOUNT>3.65</AMOUNT>
<DRIVETHROUGH>true</DRIVETHROUGH>
</ROW>
<ROW>
<RESTAURANT>A&W</RESTAURANT>
<DATE>2021-09-28</DATE>
<AMOUNT>44.94</AMOUNT>
<DRIVETHROUGH>false</DRIVETHROUGH>
</ROW>
<ROW>
<RESTAURANT>McDonalds</RESTAURANT>
<DATE>2021-09-28</DATE>
<AMOUNT>33.07</AMOUNT>
<DRIVETHROUGH>false</DRIVETHROUGH>
</ROW>
<ROW>
<RESTAURANT>BurgerKing</RESTAURANT>
<DATE>2021-09-28</DATE>
<AMOUNT>13.82</AMOUNT>
<DRIVETHROUGH>false</DRIVETHROUGH>
</ROW>
<ROW>
<RESTAURANT>Arby's</RESTAURANT>
<DATE>2021-09-29</DATE>
<AMOUNT>24.77</AMOUNT>
<DRIVETHROUGH>false</DRIVETHROUGH>
</ROW>
<ROW>
<RESTAURANT>BurgerKing</RESTAURANT>
<DATE>2021-09-29</DATE>
<AMOUNT>13.13</AMOUNT>
<DRIVETHROUGH>true</DRIVETHROUGH>
</ROW>
<ROW>
<RESTAURANT>Subway</RESTAURANT>
<DATE>2021-09-29</DATE>
<AMOUNT>17.10</AMOUNT>
<DRIVETHROUGH>false</DRIVETHROUGH>
</ROW>
<ROW>
<RESTAURANT>McDonalds</RESTAURANT>
<DATE>2021-09-29</DATE>
<AMOUNT>17.26</AMOUNT>
<DRIVETHROUGH>true</DRIVETHROUGH>
</ROW>
<ROW>
<RESTAURANT>A&W</RESTAURANT>
<DATE>2021-09-29</DATE>
<AMOUNT>24.01</AMOUNT>
<DRIVETHROUGH>true</DRIVETHROUGH>
</ROW>
<ROW>
<RESTAURANT>A&W</RESTAURANT>
<DATE>2021-09-29</DATE>
<AMOUNT>18.73</AMOUNT>
<DRIVETHROUGH>false</DRIVETHROUGH>
</ROW>
<ROW>
<RESTAURANT>BurgerKing</RESTAURANT>
<DATE>2021-09-29</DATE>
<AMOUNT>9.89</AMOUNT>
<DRIVETHROUGH>true</DRIVETHROUGH>
</ROW>
<ROW>
<RESTAURANT>Arby's</RESTAURANT>
<DATE>2021-09-30</DATE>
<AMOUNT>22.29</AMOUNT>
<DRIVETHROUGH>false</DRIVETHROUGH>
</ROW>
<ROW>
<RESTAURANT>BurgerKing</RESTAURANT>
<DATE>2021-09-30</DATE>
<AMOUNT>12.45</AMOUNT>
<DRIVETHROUGH>true</DRIVETHROUGH>
</ROW>
<ROW>
<RESTAURANT>Subway</RESTAURANT>
<DATE>2021-09-30</DATE>
<AMOUNT>32.90</AMOUNT>
<DRIVETHROUGH>false</DRIVETHROUGH>
</ROW>
<ROW>
<RESTAURANT>McDonalds</RESTAURANT>
<DATE>2021-09-30</DATE>
<AMOUNT>13.59</AMOUNT>
<DRIVETHROUGH>true</DRIVETHROUGH>
</ROW>
<ROW>
<RESTAURANT>Wendy's</RESTAURANT>
<DATE>2021-09-30</DATE>
<AMOUNT>21.94</AMOUNT>
<DRIVETHROUGH>true</DRIVETHROUGH>
</ROW>
<ROW>
<RESTAURANT>McDonalds</RESTAURANT>
<DATE>2021-09-30</DATE>
<AMOUNT>22.12</AMOUNT>
<DRIVETHROUGH>true</DRIVETHROUGH>
</ROW>
<ROW>
<RESTAURANT>BurgerKing</RESTAURANT>
<DATE>2021-09-30</DATE>
<AMOUNT>12.77</AMOUNT>
<DRIVETHROUGH>true</DRIVETHROUGH>
</ROW>
</DATA>
<Datasource id="fastfood" url="api.web/data/fastfood" autoexecute="true">
<PIVOT row="DATE" column="RESTAURANT" field="AMOUNT" />
</Datasource>
<TABLE Datasource="fastfood" paged="false">
<DATAROW id="datarow" height="35" selectedcolor="#EFFFEF" color="#FFF0F0" bordercolor="orange"/>
<DATACOLUMN sort="DATE" width="100">
<HEADER><TEXT label="Date" /></HEADER>
<CELL selectedbordercolor="orange">
<TEXT color="orange" label="{DATE}"/>
</CELL>
</DATACOLUMN>
<DATACOLUMN sort="MCDONALDS" width="100">
<HEADER><TEXT label="McDonalds" /></HEADER>
<CELL selectedbordercolor="blue">
<TEXT color="orange" label="{McDonalds}"/>
</CELL>
</DATACOLUMN>
<DATACOLUMN sort="BURGERKING" width="100">
<HEADER><TEXT label="Burger King" /></HEADER>
<CELL selectedbordercolor="blue">
<TEXT color="orange" label="{BurgerKing}"/>
</CELL>
</DATACOLUMN>
<DATACOLUMN sort="A&W" width="100">
<HEADER><TEXT label="A&W" /></HEADER>
<CELL selectedbordercolor="blue">
<TEXT color="orange" label="{A&W}"/>
</CELL>
</DATACOLUMN>
<DATACOLUMN sort="WENDY'S" width="100">
<HEADER><TEXT label="Wendy's" /></HEADER>
<CELL selectedbordercolor="blue">
<TEXT color="orange" label="{Wendy's}"/>
</CELL>
</DATACOLUMN>
<DATACOLUMN sort="ARBY'S" width="100">
<HEADER><TEXT label="Arby's" /></HEADER>
<CELL selectedbordercolor="blue">
<TEXT color="orange" label="{Arby's}"/>
</CELL>
</DATACOLUMN>
<DATACOLUMN sort="SUBWAY" width="100">
<HEADER><TEXT label="Subway" /></HEADER>
<CELL selectedbordercolor="blue">
<TEXT color="orange" label="{Subway}"/>
</CELL>
</DATACOLUMN>
</TABLE>