If you have a comment on this topic, contact Aptify Documentation. If you want to return to the Aptify Community Site, please click here.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

When you want the data from a UI Part Metadata Item and you're working in JavaScript, the Aptify JavaScript API provides a handy interface.

Step-by-step guide

  1. Know the Table Name you want to access – not the Name of the UI Part Metadata Item itself, but of one of its Tables that has Include In Data Set checked.

    var upmiTable = "entityCards";
  2. Call Aptify.framework.utility.cache.getMetaData and use the UI Part Metadata Item in the callback.

    Access a UI Part Metadata Item
    Aptify.framework.utility.cache.getMetaData(upmiTable, function (data) {
    	// If we end up in the callback, we know that we've succeeded
    	// data holds the JSON array tied to the upmiTable key
    });

    So, for the Entity Cards array, which has a JSON UI Part that looks like this:

    Entity Cards UI Part Metadata Item JSON
     {"entityCards": 
    	[	{"id":"1","name":"Persons Default", ..., 
    		 "uiParts":
    			[	{"id":"1","entityCardId":"1", ...}
    			]
    		},
    		{"id":"2","name":"Companies Default", ..., 
    		 "uiParts":
    			[	{"id":"2","entityCardId":"2", ...}
    			]
    		},
    		...
    	]
    }

    The "data" parameter passed to the callback function will look like this:

    JSON Array From getMetaData()
    [	{"id":"1","name":"Persons Default", ..., 
    	 "uiParts":
    		[	{"id":"1","entityCardId":"1", ...}
    		]
    	},
    	{"id":"2","name":"Companies Default", ..., 
    	 "uiParts":
    		[	{"id":"2","entityCardId":"2", ...}
    		]
    	},
    	...
    ]

    Because getMetaData() is a function that accesses the cache, it's possible for it to return synchronously if the requested metadata is already in the browser's local storage:

    Synchronous Use of getMetaData()
    var data = Aptify.framework.utility.cache.getMetaData(upmiTable); 

    However, you as the programmer are not in control of the cache, so the best practice is to stick to using the function asynchronously.

Filter by label

There are no items with the selected labels at this time.

  • No labels