Examples DocumentChange operations on columns

文件资料 • 17 分钟的阅读
在此文中

With the DocumentChange it is also possible to perform operations on columns, in case you want to modify, add or replace a column.

Columns properties 

  • alignement
    • type: text
    • values: left|right|center
  • description
    • type: text
  • header1
    • type: text
  • header2
    • type: text
  • name
    • type: text
  • nameXml
    • type: text
  • width
    • type: number
    • values: in mm, max value 10000
  • definition
    • type: object
    • values: text, number, amount, date, time, bool, timestamp, timecounter, links,textmultiline, markdown, mime, textencrypted, Default value: text
    • decimals
      Number of decimals for types amount and number. Default value: 2
  • operation
    • values: add|delete|modify|move|replace

 

Javascript
Copy
{
   "name": "MyColumn",
   "nameXml": "MyColumn",
   "description": "This is my column with an amount",
   "header1": "MyColumn",
   "definition" : {
      "type": "amount",
      "decimals": "4"
   },
   "operation": {
      "name": "add"
   }
}

Example adding a column

The following example shows how to append a column to the Accounts table. If you indicate the sequence, the column will be inserted at the given position. try this operation

Javascript
Copy
{
    "format": "documentChange",
    "error": "",
    "data": [{
        "document": {
            "dataUnits": [{
                "data": {
                    "viewList": {
                        "views": [{
                            "columns": [{
                                    "alignement": "center",
                                    "description": "center column",
                                    "nameXml": "CenteredColumn",
                                    "header1": "My Header 1",
                                    "header2": "My Header 2",
                                    "width": 200,
                                    "operation": {
                                        "name": "add",
                                        "sequence": 0
                                    }
                                }],
                            "id": "Base",
                            "nameXml": "Base",
                            "nid": 1
                        }]
                    }
                },
                "id": "Accounts",
                "nameXml": "Accounts",
                "nid": 100
            }]
        }
    }]
}

Example modifying a column

The following example shows how to modify the existing column at line 2 in the Transactions table.

Javascript
Copy
{
    "format": "documentChange",
    "error": "",
    "data": [{
        "document": {
            "dataUnits": [{
                "data": {
                    "viewList": {
                        "views": [{
                            "columns": [{
                                "header1": "NewDescription XXXX",
                                "nameXml": "Description",
                                "operation": {
                                    "name": "modify",
                                    "sequence": "1"
                                }
                            }],
                            "id": "Base",
                            "nameXml": "Base",
                            "nid": 1
                        }]
                    }
                },
                "id": "Transactions",
                "nameXml": "Transactions",
                "nid": 103
            }]
        }
    }]
}

Example replacing a column

The following example shows how to replace the existing column at line 24 in the Transactions table.

Javascript
Copy
{
    "format": "documentChange",
    "error": "",
    "data": [{
        "document": {
            "dataUnits": [{
                "data": {
                    "viewList": {
                        "views": [{
                            "columns": [{
                                "nameXml": "Amount",
                                "header1": "AmountAsText",
                                "definition": {
                                    "type": "text"
                                },
                                "operation": {
                                    "name": "replace",
                                    "sequence": "23"
                                }
                            }],
                            "id": "Base",
                            "nameXml": "Base",
                            "nid": 1
                        }]
                    }
                },
                "id": "Transactions",
                "nameXml": "Transactions",
                "nid": 103
            }]
        }
    }]
}

Example deleting a column

The following example shows how to delete the existing column at line 2 in the Accounts table.

Javascript
Copy
{
    "format": "documentChange",
    "error": "",
    "data": [{
        "document": {
            "dataUnits": [{
                "data": {
                    "viewList": {
                        "views": [{
                            "columns": [{
                                "nameXml": "Description",
                                "operation": {
                                    "name": "delete"
                                    "sequence": "1"
                                }
                            }],
                            "id": "Base",
                            "nameXml": "Base",
                            "nid": 1
                        }]
                    }
                },
                "id": "Accounts",
                "nameXml": "Accounts",
                "nid": 100
            }]
        }
    }]
}

Example moving a column

The following example shows how to move the existing column to line 2 in the Transactions table. To know the number of a column, double-click on the header of one of them, in the dialog that opens you can see all the available columns, they are represented in ascending order. values start from 0.

Javascript
Copy
{
    "format": "documentChange",
    "error": "",
    "data": [{
        "document": {
            "dataUnits": [{
                "data": {
                    "viewList": {
                        "views": [{
                            "columns": [{
                                "nameXml": "Description",
                                "operation": {
                                    "name": "move",
                                    "sequence": "2"
                                }
                            }]
                        }]
                    }
                },
                "nameXml": "Transactions"
            }]
        }
    }]
}

 

请帮助我们完善必备文件

我们非常欢迎您发送宝贵的反馈意见

请告诉我们什么主题需要更好的解释或如何才能更好的对其诠释。

分享这篇文章: Twitter | Facebook | LinkedIn | Email