cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Metadata JSON navigation

GianVal
15-Moonstone

Metadata JSON navigation

I want to navigate the metadata JSON file as I do with regular JSON files like the example below

 

myjson["/0/1/0"]["InnerField1"]["DetailExample"]

 

but I want to do this with metadata Vuforia API. How to? 

Many thanks

1 ACCEPTED SOLUTION

Accepted Solutions
pandersson
13-Aquamarine
(To:GianVal)
2 REPLIES 2
pandersson
13-Aquamarine
(To:GianVal)

Once you have executed say for example PTC.Metadata.fromId  as shown below you can use just like standard json but the functions provided in the link by @pandersson might be easier 

 

$scope.$on('userpick', function (event, targetName, targetType, eventData) {

var pathid = JSON.parse(eventData).occurrence;

try {
PTC.Metadata.fromId(targetName).then((metadata) => {

var displayName = metadata.get(pathid, 'Display Name');

CURRENT_OCCURANCE = pathid;

resetHighlight();
var itemArray = [];
itemArray.push(targetName+'-'+pathid);
SELECTED_ITEMS.push(targetName + '-' + pathid);

//hilite(itemArray,true);
setColor(itemArray, HIGHLIGHT_COLOR);

doPopup(displayName, pathid);

});

} catch (err) {

console.log(err);
}

});

 

sgreywilson_0-1641389536118.png

 

Top Tags