Closed Ryo-N7 closed 1 year ago
field conversion//split field into separate/etc. is not possible in ActivityInfo API
-- export and re-import into new field
Alex: create new functionality to make easier
Take oldField and newField and an R function to convert the values. It will copy over the data to the new field (using importTable with recordId field and possibly parentId).
tried to migrateField()
but it doesn't seem to be working despite the "import" being successful:
before migrateField()
:
theformobj <- getRecords(form = "co8ify9lfrpd3z5b")
attempt migrateField()
:
it says "success" but i don't see the migrated values anywhere?
not in the current form object i modified, theformobj
:
nor in the db itself:
I think it is the fn() that is introducing NAs by coercion. The letters are not converting to numbers (as.numeric) in R.
Nick
On Tue, Mar 28, 2023, 06:57 Ryo Nakagawara @.***> wrote:
tried to migrateField() but it doesn't seem to be working despite the "import" being successful:
BEFORE migrateField():
theformobj <- getRecords(form = "co8ify9lfrpd3z5b")
[image: before-migrate-field] https://user-images.githubusercontent.com/19657164/228131386-c3f8d238-c670-42bd-9b97-ccc4c4acad04.PNG
attempt migrateField(): [image: migrate-field-proc] https://user-images.githubusercontent.com/19657164/228131459-dc2b0aa5-75c9-4098-a54b-a2f3efec12ff.PNG
it says "success" but i don't see the migrated values anywhere?
not in the current form object i modified, theformobj: [image: where-is-mig-data] https://user-images.githubusercontent.com/19657164/228131961-a6825c72-4348-4238-935d-dabe720b285e.PNG
nor in the db itself:
[image: where-is-mig-data2] https://user-images.githubusercontent.com/19657164/228131968-f450f2b3-c174-4d42-88de-fbbf857071ed.PNG
— Reply to this email directly, view it on GitHub https://github.com/bedatadriven/activityinfo-R/issues/31#issuecomment-1486215529, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOP4ADOHAAOP3CRW6CNLV3W6JVSFANCNFSM6AAAAAASLDAVZA . You are receiving this because you were assigned.Message ID: @.***>
Preserve the data inside fields that have changed types (within type changes that make sense, of course).
Currently doesn't work, data is wiped away when underlying field type changes. This was actually a
Feature request
brought up by project staff originally but since I knew about theupdateFormSchema()
function I had told them they could just use the R package. But unfortunately with the above problem, it's a harder sell as project staff don't want to lose data that already exists in the fields.Of course, values getting wiped makes sense if I'm changing like
DATE
tonumeric
orAttachment
totext
or some other weird conversion but for something liketext
toquantity
(and vice-versa), which is a conversion that's going to happen a lot (whether due to a mistake or otherwise), it would be nice if we could preserve the underlying values somehow?