Using Set Functions

Top Previous Topic Next Topic  Print this topic

In this example, we will illustrate the use of dataset functions through a simple example: Sort.

 

We will continue with the document created in our previous example, Using Functions:

 

example2-2

 

Step 1: Insert the desired dataset function

 

We will want to use a sorted version of the Emp table. Click on the Sort button in the Dataset group.

 

Step 2: Bind the data

 

First delete the data source connection between the Emp table and Output (right click on the line and select Delete), since we will be using the Sort output instead.

 

Connect the Sort element to the other elements in the diagram like this:

 

example3-1

 

We have passed the data source through the Sort dataset function before aggregating in the Output.

For the sort rule, we have used the FIRST_NAME field, but this can also be the output of another function.

 

Step 4: View the output

 

To view the output, go to the View tab and select Output View. You will see the following XML:

 

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<ns:root xmlns:ns="http://www.tempuri.org/XML">

       <ns:emp first-name="Arthur" last-name="Clark" full-name="Arthur,Clark"/>

       <ns:emp first-name="John" last-name="Brown" full-name="John,Brown"/>

       <ns:emp first-name="Mary" last-name="Jane" full-name="Mary,Jane"/>

</ns:root>

 

 

Note: This sample can be found in SortSample.dax from Samples\Job Samples folder.