Examples DocumentChange operations on columns

Documentation •
In this article

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

{
   "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



{
    "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.



{
    "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.



{
    "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.




{
    "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.




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


Tell us how we can help you better
If the information on this page is not what you're looking for, is not clear enough, or is not up-to-date, let us know.

Share this article: Twitter | Facebook | LinkedIn | Email