Hi All,
I'm trying to set a checkbox style Metadata Selection field (along with various other metadata fields) using setMetadataAllFields(). I was wondering if someone knows what format the checkbox data has to be in when it is passed to setMetadataAllFields?
I assumed that it was just a string similar to the output from %asset_metadata_[selectFieldName]% which gives "option1; option2; option3" etc, but this doesn't seem to be working.
Cheers,
Andrew.
[quote]
Hi All,
I'm trying to set a checkbox style Metadata Selection field (along with various other metadata fields) using setMetadataAllFields(). I was wondering if someone knows what format the checkbox data has to be in when it is passed to setMetadataAllFields?
I assumed that it was just a string similar to the output from %asset_metadata_[selectFieldName]% which gives "option1; option2; option3" etc, but this doesn't seem to be working.
Cheers,
Andrew.
[/quote]
Hi Andrew,
I am guessing its multiple selection checkbox metadata field. You can use the keys for these selection to set the Metadata value.
So for example if the Metadata Selection Field is mapped as follows :
Key :: Value
1 Optiont1
2 Optiont2
3 Optiont3
you can use the value as 1; 2 or 1; 2; 3 and so forth to set the metadata (visible) values to Options1; Option2; or Option1; Option2; Option3 respectively.
Irrespective what part (key/value) is set to be visible for this selection, we can always set the metadata values with the key.
Hope this helps.
Ash
[quote]
Hi Andrew,
I am guessing its multiple selection checkbox metadata field. You can use the keys for these selection to set the Metadata value.
So for example if the Metadata Selection Field is mapped as follows :
Key :: Value
1 Optiont1
2 Optiont2
3 Optiont3
you can use the value as 1; 2 or 1; 2; 3 and so forth to set the metadata (visible) values to Options1; Option2; or Option1; Option2; Option3 respectively.
Irrespective what part (key/value) is set to be visible for this selection, we can always set the metadata values with the key.
Hope this helps.
Ash
[/quote]
Hey Ash,
How do you pass the metadata values to setMetadataAllFields()? As a string? As an array? As an object with key: value pairs?
Cheers,
Andrew.
[quote]
Hey Ash,
How do you pass the metadata values to setMetadataAllFields()? As a string? As an array? As an object with key: value pairs?
Cheers,
Andrew.
[/quote]
Hey Andrew,
setMetadataAllFields() accepts the argument as an array in which the array key is the id of the metadata field and the array value is the value to be set against that particular metadata field.
And in you case the string (e.g) “1; 2; 3” it just goes against respective metadata field id.
You can also find more examples here.
Ash.
[quote]
Hey Andrew,
setMetadataAllFields() accepts the argument as an array in which the array key is the id of the metadata field and the array value is the value to be set against that particular metadata field.
And in you case the string (e.g) “1; 2; 3” it just goes against respective metadata field id.
You can also find more examples here.
Ash.
[/quote]
Cheers Ash.