
How to import data from text field to dynamic choice field
I am importing data from a CSV made from an older table. The old table had 'Patient Name' as a text field and the new table I am importing it into is a dynamic choice field. After I imported all of the data, the Patient Name field is empty on every record. How do I import the old data into the new field?
-
Steven Rooryck, it is the other way around. DC fields work normal for me and having issues with link fields showing only the first 100 or not finding result for searches.
Alan F, DC field requires a record Id. It shows a field value of your choice but when you try to push a text value in, it doesn’t know what record it is.
-
I did indeed write that trying to put a text in a DC field does not work. But one does not need to submit a full record ID: since the identity of the source table is known by the very definition of the DC field, one must just submit the record index.
I did ask a question in order to propose a tailor-made solution, but got no answer. So, let's suppose that there is a "Patient Names" table with the field "Patient Name" in it, and that all the patients have been imported in that table. Let's suppose also that, in the table where the DC field sits, this field is defined as: "select 'Patient Names'".
A temporary text field, named for example "Temp Name" should be defined in the same table as the DC field, and the patient names should be imported in that field. Then, the "Update multiple records…" command should be invoked from the "gear" menu. The "Patient Name" DC field should be set to "Assign calculated value", with the formula:
let pn := 'Temp Name'; number(first((select 'Patient Names')['Patient Name' = pn]).Id)
The "first" function is needed because "select" always returns an array of values.