---
url: /flow/guide/scripting-reference/classes/data-set/tfloclientdataset.create.md
---

# TFloClientDataset.Create

## Declaration

`constructor TFloClientDataset.Create(nil): TFloClientDataset;`

### Example

```pascal
procedure ScriptEvent (var Value : variant);
var
  myDataset : TFloClientDataSet;
begin
  myDataset := TFloClientDataSet.Create(nil); // always use nil parameter with Create
  try // use a "try ... finally" block to prevent memory leaks
    // the following lines are one example of using a local dataset
    GetCustomDataSet(myDataset, ['Id','Name']); //define the columns
    myDataset.Insert; // insert a new row into the dataset
    myDataset['Id'].Value := 1; // set a value into the Id field in that row
    myDataset['Name'].AsString := 'Cameron';
    myDataset.Post; // save the new or changed values in that row
      LogInfo('Name field has value: ' + myDataset['Name'].AsString); // read a value from the dataset
  finally // free the object from memory when you have finished with it
         myDataset.Free;
  end;
end;
```

## Description

To use a local dataset within a Custom Script (or within a Map if you wish), you must first create the dataset object. The created object will not have any columns or rows initially ... use [GetCustomDataSet](/flow/guide/scripting-reference/functions/database/getcustomdataset), [GetDataSetFromSource](/flow/guide/scripting-reference/functions/database/getdatasetfromsource), [Insert](/flow/guide/scripting-reference/classes/data-set/dataset.insert), etc to build up the structure and contents of the dataset. Within a Map, the [Global Dataset](/flow/guide/scripting-reference/variables/global-datasets) objects are created automatically by Flow.

Note: If you choose to use TFloClientDataSet.Create(nil) to generate a new dataset then you should also remove the dataset when you have finished with it, by calling "\<dataset>.Free". The example above does this via the pattern "try ... finally ... myDataset.Free".
