Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Blogs / Jesús Almaraz blog / Data support generic data u...

Data support generic data upgrader: data transfer Part 1

The making of
After make app Data support to edit any data in Business Central I had an idea to make this bigger and make a tool to avoid BC programmers to do the repetitive work of make processing only reports to modify and create data. You know what I mean:
  • Fix an incorrect field in a table with a constant value.
  • Create rows in a table from other table values.
  • Set a field value in a table from other, specifying the fields links between these two tables.
The target users of the tool are functional consultant to make the most part of modifying process without developers. I hope I am not re-inventing the wheel.
I didn´t find the best way too do it then, so I leave the idea. But later we began to use data transfer AL data type and then I discovered how this can be done. https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/datatransfer/datatransfer-data-type , but when I did the tool I notice that the documentation does not lie: we can use this data type only during upgrade and installation so, apply this for make data updates in final production, was impossible.
Was not a total lost, because following the Data transfer philosophy a generic data upgrader was possible, with Recordref and FieldRef data types. A pity, because data transfer updating is very much faster than sequential record processing.
You can download the app in link https://github.com/JalmarazMartn/BCDataSuport/blob/master/Jes%C3%BAs%20Almaraz%20mart%C3%ADn_BCDataSuport_1.0.0.8.app
Disclaimer
I enjoy making this kind of crazy stuff, but doesn´t mean that everybody must use it. Be careful.
Tool is supported but not in the same way my company apps. I have a marginal dedication that involves worst time response in fixes: you can notify incidences and improvement requests in https://github.com/JalmarazMartn/BCDataSuport/issues
The tool is quite safe but check it first in test and sandbox environments before use it in production until checking is completed.
Use case 1: Copy Rows, creating new records
In this example we are going to do this operation: creating in table 97 a customer comments with their City, from table 18, Customer, only if customer had a value in City field.
Steps:

Step1 Data transfer Header

Search/Data Support Data Transfers. Press New to create a New one, and Set these fields in header:
​​​​​​​
  • Set a number for data transfer, “INSERTAR”.
  • An optional description.
  • Table from: source table of the transfer.18=Customer.
  • Table To: 97=Comment Line.
  • Data Action: Copy Rows. That means that we are going to create new rows in destination table, “Comment Line”.

Step2 Data Transfer fields

In this step we set the values for the fields of the destination tables, in the “Data transfer fields” Page part in the same main page:


Two kinds of values can be settled:
  • Constant: In table name we set the enumeration value “Customer” and “Line No.” is 69000.
  • A table value, from source table: Field No. in Comment will be Customer No. and Comment text field will be Customer City.

Step 3 Data transfer Source filters.

In the page part “Data transfer source filters” we can set which source table rows we want to use in the transfer:


This set that only customers with City will be taken in data transfer process.

Step 4 Show Breakdown and execute

Pressing action “Show Break Down”, a message with transfer explanation will be showed:
You will CREATE NEW ROWS in Comment Line With values:
Table Name=Customer
No.=Customer.No.
Line No.=69000
Comment=Customer.City
WHERE
Customer.City=<>''
When we press “Execute” we will get two confirmations:
  • A previous one with the breakdown.
  • After the process, another confirmation request wit the number of created or modified rows.
In this case the result are new rows in comment table:
​​​​​​​

Next post: Case 2 copy fields and Case 3 set values in a table.

Comments