edmiVersionGetAttrBN
EdmiError edmiVersionGetAttrBN(SdaiInstance instance,
SdaiVersion version,
SdaiString attributeName,
SdaiPrimitiveType valueType,
SdaiVoid value);
Returns the value of an attribute of a given application instance within a model version other than the current. The value type may also have changed between versions of the population. Use edmiVersionGetAttrDatatype to find the value type.
Arguments
Type | Name | Comment |
SdaiInstance | instance | The instanceID of an application instance in the edmModel for which an attribute shall be read in from an earlier version of the model. |
SdaiVersion | version | The version number of the edmModel in question. The version number is a sequence number counting from one with an increment of one for each new model version created. |
SdaiString | attributeName | Specifies the name of the attribute. Attribute names are case insensitive. |
SdaiPrimitiveType | valueType | The primitive data type of the attribute to be read. |
SdaiVoid | value | Variable that will receive a pointer to the value of the given attribute of <instance> for the <version> of the edmModel. |
Return Value
Options
Example
EdmiError rstat;
SdaiInteger nWrn, nErr;
SdaiRepository repId;
SdaiModel modelId;
SdaiVersion version1Id, version2Id;
SdaiModelVersion modelVersionId;
SdaiInteger myInteger;
SdaiReal myReal;
SdaiInstance instId;
SdaiAttr attrId;
SdaiPrimitiveType type;
/* Compile schema */
rstat = edmiCompileFile("c:/data/MyFile.exp",
"c:/tmp/MyFile.dia",
"MySchema", 0, &nWrn, &nErr);
/* Create Model */
rstat = edmiGetRepository("MyRepository", &repId);
modelId = edmiCreateModelBN(repId, "MyModel", "MySchema", 0);
/* Populate Model */
instId = edmiCreateInstanceAndPutAttrsBN(modelId, "MyEntity", 1,
"REAL_ATTR", sdaiREAL, 3.14);
/* Create version 1 */
rstat = edmiCreateModelVersion("MyRepository", "MyModel",
"V1", &modelVersionId);
/* Change population */
sdaiPutAttrBN(instId, "REAL_ATTR", sdaiINTEGER, 1);
/* Create version 2 */
rstat = edmiCreateModelVersion("MyRepository", "MyModel",
NULL, &modelVersionId);
/* Get Id of version 1 */
rstat = edmiGetModelVersionIdBN("MyRepository", "MyModel",
"V1", &modelVersionId, &version1Id);
/* Type is sdaiREAL */
rstat = edmiVersionGetAttrDatatypeBN(instId, version1Id,
"REAL_ATTR", &type);
/* Value is 3.14 */
if (type != sdaiREAL) goto error;
rstat = edmiVersionGetAttrBN(instId, version1Id, "REAL_ATTR",
type, &myReal);
/* Get Id of version 2 */
attrId = sdaiGetAttrDefinitionBN("MySchema", "MyEntity", "REAL_ATTR");
rstat = edmiGetModelVersionId(modelId, "version2",
&modelVersionId, &version2Id);
/* Type is now sdaiINTEGER */
rstat = edmiVersionGetAttrDatatype(instId, version2Id,
attrId, &type);
/* Value is 1 */
if (type != sdaiINTEGER) goto error;
rstat = edmiVersionGetAttr(instId, version2Id, attrId,
type, &myInteger);
/* Roll back to version 1 */
rstat = edmiRollbackModel(modelId, version1Id,
KEEP_ALL_MODEL_VERSIONS);
/* Delete version 2 */
edmiDeleteModelVersion(modelId, version2Id);
error:
. . .
See also
Filter by label
There are no items with the selected labels at this time.