How to summarize the data from a datafile using SQL query and persist the summarized data to a datafile
This example demonstrates how to create a data file by reading data from the Database using SQL query.
In this example, considering the HICC application, you create the dataset using "ddCreateDataSet" command and set the DB context using "dbSetContext" command to execute the SQL query using "dbExecuteQuery" command, Now persist the dataset to a Datafile using "ddPersistDatasetToDataFile" command.
Solution:
# | Command | Target | Value |
---|---|---|---|
Create a dataset | |||
1 | ddCreateDataSet | hiccdata |
HICC Data Definition(W) |
Start of a dbCONNECT Block | |||
2 | dbBlockOpen | Insurance Details(W) | InsuranceDetails |
To specify to Worksoft SaaS the "database" and "dbCONNECT tunnel" names | |||
3 | dbSetContext |
dbCONNECT Tunnel Name | dbAliasName |
To execute the DB Query | |||
4 | dbExecuteQuery |
select income, age, zipcode from ipc_data_wip order by 1 | ipcdata |
End of a dbCONNECT Block | |||
5 | dbBlockEnd |
||
To persist the data into the Data File | |||
6 | ddPersistDatasetToDataFile |
hiccdata | HICC Details From DB |
Tips, Tricks, Gotcha's & Best Practices:
- Data Definition mentioned above should be available with the specified Name and status in Worksoft SaaS.
- While persisting dataset to a Datafile, mention the status of the data file, by default Active version will be created.