How do I read data from a data file
This example demonstrates reading data into a dataset from a data file.
In the solution shown below, you will see a dataset is created with the specified data definition that holds the attributes of the data file using "ddCreateDataSet" command. The data from the data file is read into this dataset using "ddCreateDatasetFromADatafile" command.
# | Command | Target | Value |
---|---|---|---|
Creating the dataset and specifying the data definition name of the data file | |||
1 | ddCreateDataSet | InsuranceDetails | Insurance Details(W) |
Reading the data from the data file into the dataset | |||
2 | ddCreateDatasetFromADatafile | Insurance Details(W) | InsuranceDetails |
Tips, Tricks, Gotchas & Best Practices:
- You should use the same dataset name which is created by using "ddCreateDataSet" command in "ddCreateDatasetFromADatafile" command.
- You can also pass the data filter name along with the data file name using the separator "||" in "ddCreateDatasetFromADatafile" command to read only the filtered rows into the dataset from the data file. To know more about data filters click here.
- You can optionally pass the status of the Data Definition and Data file along with their names in "ddCreateDataSet" and "ddCreateDatasetFromADatafile" commands respectively. Allowed values for status are 'W'(WIP) and 'A'(Active). If the status value is not passed, the status is assumed to be 'W'(WIP).
- As a best practice, it is always advisable to define the variable names without any spaces and if you want to differentiate the words, use underscores.