# Data Manager

In this documentation you will find the fundamentals on how the **.NET DCP** and **WebMAP** operate for the interactions between the front-end and back-end applications to handle the **Data Managers** data.

## Data Manager back-end and front-end synchronization <a href="#data-manager-back-end-and-front-end-synchronization" id="data-manager-back-end-and-front-end-synchronization"></a>

In order to display to the client a Data Manager's content its data needs to be synchronized between the front-end and the back-end of the application. To accomplish this there are two key components that serve as communicators between the application's server and the client's browser. Those components are the following:

* Data Manager and Data Manager Control Models
* GetDataBundlePage API

### Data Manager Models <a href="#data-manager-models" id="data-manager-models"></a>

The Data Manager Control Model is a data representation of the basic information that is needed to render its respective component in the front-end application. It mainly contains the visual structure of the control (such as visibility, position, etc), the control events and its associated Data Manager Model. The Data Manager Control does not contain any kind.

#### Data Manager Control Model JSON <a href="#data-manager-control-model-json" id="data-manager-control-model-json"></a>

```
{
    "Border": false,
    "BorderStyle": 2,
    "DirtyContent": true,
    "DragAuto": false,
    "Enabled": true,
    "EventChanges": {
        "dwnitemvalidationerror": true
    },
    "Position": {
        "Height": 84,
        "Width": 288,
        "X": 21,
        "Y": 123
    },
    "TabOrder": 10,
    "Title": "",
    "TitleBar": false,
    "Visible": true,
    "VisualControlType": "DataControl",
    "VScrollBar": false,
    "Id": "53067372-bd2b-42d4-9a20-d9db16487f56",
    "MapperId": "application+dm_sample",
    "References": {
        "DataManager": "6ca7995d-e7a0-4387-8720-643aa0c4cb5c",
        "Parent": "8c74a413-f58b-4924-b472-6ad587e20992"
    }
}
```

The Data Manager Model is used to represent the inner structure that compose the component. It's purpose it to holder references to its controls (computes, columns,text objects, lines, etc), handle its synchronization status such as whether or not the data should be reloaded, the selected rows, the text of the current control, among others. The model does not contains any kind of data for its inner controls, this data is handled by a different mechanism, the GetDataBundlePage API.

#### Data Manager Model JSON <a href="#data-manager-model-json" id="data-manager-model-json"></a>

```
{
    "Id": "6ca7995d-e7a0-4387-8720-643aa0c4cb5c",
    "MapperId": "applicationd_sample_dm",
    "References": {
        "column_control": "6d147182-6ffd-4a86-97fd-337082b3e425",
        "compute_control": "956edaa8-b0c0-4c40-8a18-afa6ab3f671e"
    },
    "CurrentControlName": "d_sample_dm",
    "CurrentRow": 1,
    "DisplayedRow": 1,
    "Dirty": true,
    "Processing": "0",
    "Enabled": true,
    "Visible": true,
    "IsDynamic": false,
    "SelectedRows": "[]",
    "TextBuffer": "sampletext",
    "Color": "ButtonFace",
    "ComputedInformation": {},
    "header": {
        "Height": 0,
        "BackColor": "transparent"
    },
    "detail": {
        "Height": 74,
        "BackColor": "transparent"
    },
    "summary": {
        "Height": 0,
        "BackColor": "transparent"
    },
    "footer": {
        "Height": 0,
        "BackColor": "transparent"
    }
}
```

### Data Manager Get Data Bundle Page API <a href="#data-manager-get-data-bundle-page-api" id="data-manager-get-data-bundle-page-api"></a>

While the Data Manager Model holds the component structure the GetDataBundlePage API is the one that is in change of putting in place its data.

Each time a Data Manager Component is loaded for the first time in the front-end application or the **Dirty** property in the model is set to true a GetDataBundlePage API is invoked; which is used to get a view of the data contained in the sever for said Data Manager.

The information bundle object is composed by the following:

* Total Items
* Column Types
* Computed Positions
* Row Data
* Column Names
* Computed Information

#### Total Items <a href="#total-items" id="total-items"></a>

Contains the total amount of rows of the Data Manager.

```
{
    "totalItems": 1
},
```

#### Column Types <a href="#column-types" id="column-types"></a>

Contains the types associated to each Data Manager's **Data Column**.

```
{
    "0": "char(40)"
}
```

#### Compute Positions <a href="#compute-positions" id="compute-positions"></a>

Contains the positions and name of the compute controls contained in the Data Manager. This field is populated only when the compute contains a valid JavaScript expression.

```
{
    "1": "compute_control"
}
```

#### Rows Data <a href="#rows-data" id="rows-data"></a>

The data of this section is calculated individually for each Data Row, the sections are the following:

**Deprecated fields**

* **WM$%S (WebMAP Status Field)**: is deprecated for WebMAP 5 in WebMAP 4 it is used to hold the field type.
* **WM$%RW**: deprecated in both WebMAP 5 and WebMAP 4, it was used to hold the original row index in case a filter is applied.

**Visual**

It contains the visual changes that should be applied to every control inside the row; it's applied individually for each one. The value is calculated in base of the **property expression** value associated to the property in the back-end, if no value is sent in here then the value in the Data Manager Model is used instead.

```
"visual": {
    "column_control": {
        "x": 67,
        "y": 53,
        "width": 217,
        "height": 17,
        "Visible": true,
        "Protect": null,
        "BackColor": "white"
    },
    "compute_control": {
        "x": 3,
        "y": 53,
        "width": 60,
        "height": 17,
        "Visible": true,
        "Protect": null,
        "BackColor": "transparent"
    }
}
```

**Computed**

It holds the evaluated expression for each computed control in the row.

```
"computed": {
    "compute_control": "Evaluated Value"
}
```

**DDDW Display**

Contains the Display text for each Drop Down Data Manager.

```
"dddwDisplay": {
    "3": "DDDW Selected Text"
}
```

**Draggable**

Indicated whether or not a row can be dragged.

```
"draggable": false
```

#### Column Names <a href="#column-names" id="column-names"></a>

This sections contains the name of each Data Column of the Data Manager.

```
[
    "column_control"
]
```

#### Computed Information <a href="#computed-information" id="computed-information"></a>

The computed information object contains the Name, expression and resulting value of each compute control contained in the Data Manager.

#### Complete GetDataBundlePage Object <a href="#complete-getdatabundlepage-object" id="complete-getdatabundlepage-object"></a>

This is the complete representation of the response sent to the back-end of the GetDataBundlePage

```
[
    {
        "totalItems": 1
    },
    {
        "0": "char(40)"
    },
    {
        "1" : "compute_control"
    },
    [
        [
            {
                "WM$%S": 0,
                "WM$%RW": 0,
                "visual": {
                    "column_control": {
                        "x": 67,
                        "y": 53,
                        "width": 217,
                        "height": 17,
                        "Visible": true,
                        "Protect": null,
                        "BackColor": "white"
                    },
                    "compute_control": {
                        "x": 3,
                        "y": 53,
                        "width": 60,
                        "height": 17,
                        "Visible": true,
                        "Protect": null,
                        "BackColor": "transparent"
                    }
                },
                "computed": {
                    "compute_control": "Evaluated Value"
                },
                "dddwDisplay": {
                    "3": "DDDW Selected Text"
                },
                "draggable": false
            },
            "Column Value"
        ]
    ],
    [
        "column_control"
    ],
    {
        "computedInformation": {
            "compute_control": {
                "expression": "(currentRow[1])",
                "resultingPbType": "varchar"
            }
        }
    }
]
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.gapvelocity.ai/webmap/powerbuilder-to-.net/desktop-compatibility-platform-dcp/data-manager.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
