Blog by Stanley Sequeira – Oct 06, 2015
In my previous post, I explained what SAQL is. Now it’s time to put it in use.
Salesforce Developers would agree with me that modifying SOQL (Salesforce Object Query Language) is rather easier where you could just get into the Developer Console and use the Query Editor Tool, but on WAVE it’s a bit different – Not Complicated, just different!
This blogpost is intended to make it a lot easier for developers to access and modify their queries on the Salesforce WAVE platform. Well it’s so easy that even Salesforce Administrators can easily get very comfortable with this. All you need to do is follow a series of steps listed below –
Step 1: First you need to download the Salesforce Dataset Utility which can be found here
Step 2: After the downloads are complete, you can open up a Client session by clicking on the executable file. If you’re a PRO then jump right into the Console (which I’ll be explaining in future blogs)
Step 3: Input your credentials and click Sign in
Step 4: Once authenticated you will be met with a list of all datasets included in your instance, select which dataset you would like to download, and click on the dataset name.
Step 5: Once you have selected a dataset (here I have selected Products Opportunities), You will see a default view including a number of columns and 100 rows. To Edit the query that is pulling the data from Salesforce Analytics Cloud, click on the Action Button drop down in the top right hand corner and select “EDIT SAQL”.
Step 6: Once the “Edit SAQL” button is pressed you will see the SAQL Query Editor, allowing you to adjust the query on the page.
Step 7: You can modify columns, change the limit of the number of rows returns and modify queries based on these clauses
Load | Loads a dataset. All SAQL queries start with a load statement. |
Filter | Selects rows from a dataset based on a filter condition called a predicate. |
Foreach | Applies a set of expressions to every row in a dataset. This action is often referred to as projection. |
Group | Groups matched records. The group and cogroup statements are interchangeable. However, cogroup is typically used to operate on more than 1 input stream |
Union | Combines multiple result sets into one result set. |
Order | Sorts by one or more attributes. |
Limit | Limits the number of results that are returned. If you don’t set a limit, queries return a maximum of 10,000 rows |
Offset | Paginates values from query results. |
Step 8: In order for you to download the dataset you will need to understand how many rows the dataset has, this can be done by looking at the “count of rows” in the dataset’s lens.
To adjust the number of rows being called at a single time the query limit needs to be adjusted and here I’ll do the following change to the query –
From:
q = limit q 100;
To:
q = limit q 4000;
Step 9: Immediately you’ll see a lot many rows appearing on screen. You can now use the “Export to CSV” button to export the query results to a CSV file.
Step 10: Below is the result of using a query for 4000 rows on the ‘Products Opportunity’ dataset and exporting the results to CSV. As you can see in the image below, 4000 rows have been downloaded.
You can always change Clauses in SAQL and see how the data set reacts to it – Happy WAVE 🙂
Wow .. this is truely amazing .. great job stan
LikeLiked by 1 person
Very nice info .. thanks Stan
LikeLiked by 1 person
Really good info, I’m trying to run this but it’s not working, can you pls help.
LikeLiked by 1 person
Hi Jasime,
Thanks!
Can you please confirm that the ‘datasetutils-32.0.XX.jar’ (XX – could be any version, current version is 27) and the rest of the files from GitHub are placed in the same folder.
Thanks,
Stan
LikeLike