Select to view content in your preferred language

Assign javascript object to Feature attribute

669
1
Jump to solution
12-17-2020 02:31 PM
Namibian
Occasional Contributor

Hi,

Is it possible to assign a javascript object to a Feature's Attributes? How do I define the field in the layer schema in reference to this attribute? 

My javascript object looks something like this:

myObject = { 
    areaColor: "a8cfe1"
    areaId: "a152D000000RDV5QAO"
    areaName: "Territory 1"
    calcAttData: []
    config: {
        center: {
           type: "geographic", 
           attribute: "", 
           coordinates:[0.0, -60.0, 10.0], 
           fixed: false
        }
    }
}

I would like to declare the feature attribute like so:

{
    assignment: myObject
}

and I think the field definition should look like this:

{
    name: 'assignment',
    type: 'blob'
}

 

Any help/guidance is greatly appreciated

Cheers!

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
ReneRubalcava
Honored Contributor

I don't think I've used this, but your field definition is correct.

I was able to use it in this sample. I don't think it would work with the FeatureTable though, but should work in other places.

View solution in original post

1 Reply
ReneRubalcava
Honored Contributor

I don't think I've used this, but your field definition is correct.

I was able to use it in this sample. I don't think it would work with the FeatureTable though, but should work in other places.