How to store and display a table of data inside vp using openAPI?

Hi Mamad,

The answer to your question can be split into two steps:

  1. Create a custom model to store the non-project data
  2. Use ETL to visualize the information

For step 1, you can define a ‘Generic Model’, which is a custom model, and to store the information through the use of tagged values. Here is the code example:

// SAVE
IGenericModel lLoginInfo = IModelElementFactory.createGenericModel();
lLoginInfo.setGenericModelType("LoginInformation"); // I categorize this GenericModel is a "Login Information"

ITaggedValueContainer lTaggedValues = IModelElementFactory.createTaggedValueContainer();
lLoginInfo.setTaggedValues(lTaggedValues);

ITaggedValue lConnectionString = lTaggedValues.createTaggedValue(); // create a tagged value to store Connection String
lConnectionString.setName("Connection String");
lConnectionString.setValue(...);

ITaggedValue lRepositoryName = lTaggedValues.createTaggedValue(); // create another tagged value to store RepositoryName
lRepositoryName.setName("Repository Name");
lRepositoryName.setValue(...);
// LOAD
IProject lProject = ...;
IModelElement[] lElements = lProject.toModelElementArray(IModelElementFactory.MODEL_TYPE_GENERIC_MODEL);
for (IModelElement lElement : lElements) {
    // find out the LoginInformation from project.
    if ("LoginInformation".equals(((IGenericModel) lElement).getGenericModelType())) {
        IGenericModel lLoginInformation = (IGenericModel) lElement;
        String lConnectionString = lLoginInformation.getTaggedValues().getTaggedValueByName("Connection String").getValue();
        String lRepositoryName = lLoginInformation.getTaggedValues().getTaggedValueByName("Repository Name").getValue();

    }
}

For step 2, please refer to the discussion here:

Hope this helps. Please feel free to contact us again if you have any questions.

Best regards,
Jick Yeung

1 Like