Updating Option Field Description via Import

Discuss your general Proclaim related queries here.
revellbikes
Posts: 488
Joined: Fri Jun 15, 2012 12:44 pm
Has thanked: 16 times
Been thanked: 51 times

Updating Option Field Description via Import

Post by revellbikes »

Hello!

When I've run import routines in the past with {Option.Description} as a column in the import data template the routine fails to update the field in Proclaim properly. If you MESSAGE the field out it contains the correct data but it doesn't display on screen unless you update the {Option.Code} field with the corresponding data.

I know it's best practice to create holding fields to import the data into then run a Linked Action on import to convert the data from there into the relevant option field description, thus preventing bad data entering Option fields.

Are there any other less labour intensive ways of performing updates in this way without writing code for each option that needs to be updated if I'm 100% sure the data being inputted will be correct?

Thanks in advance.

marting
Posts: 1
Joined: Fri Oct 01, 2021 8:52 am

Re: Updating Option Field Description via Import

Post by marting »

Hi revellbikes

Did you ever find a way round this - just come across it myself and seems crazy to store into a text field and then write to an option.description field...

I've tried various things but no joy - if I show the contents of the code and description field in Quick View they both show the text I imported but the field won't show the value properly...

Thanks
Martin

steve
Posts: 470
Joined: Wed Nov 30, 2011 10:20 pm
Been thanked: 120 times

Re: Updating Option Field Description via Import

Post by steve »

surely you can only ever import the option.Code (strictly, the first column) directly into casedata as this is the only constrained column - all others allow duplicates / nulls.
Behind the scenes, you are only storing the chosen (e.g.) option.Code for the case in the database, and all the other option columns are derived / looked up from that.

It is possible to code up a rough workaround to automatically map the imported 'description' into the correct 'code' into which to update your casedata with. You still need a holding field though to contain the imported .Description value.

You have to make an assumption there is a one-to-one mapping of option.detail to option.code, or use the FIRST or LAST option.Code that matches.


something along the lines of a FETCH command that finds the first/last option value for a given db field where the option_detail column in question matches the imported option.Detail value in the holding field.

imagine we have an option field with field ID/Code (from db maint) of 12345.
imagine we are importing an Option.Detail value into a {detail holding field.Text}, and Option.Detail is our second column in options maintenance (i.e. the first non 'Code' column)
We actually want to update our case with the corresponding option.code that matches this option.detail.
pseudocode:

Code: Select all

vcode = FETCH FIRST field_options.option_value from field_options where field_id = 12345 and option_detail[1] = {detail holding field.Text}
put(vcode, option.Code}