Using Identifier selections for control case content


Userlevel 5
Badge +7

Storing data in so-called cases is the proprietary way of AIMMS to store snapshots of data.

For instance, to limit the size, but also to permit loading data for just a selection of identifiers, so-called Case Content Types can be used. 

Consider a simple application, having scalar parameters a, b, c, and d.  c is the only defined parameter and has definition a * b.
Filling in 3,4, and 5 for a, b, and d respectively results in the following screen shot:
 

 

With the WebUI data manager, and as Case Content Type: { a, b }, we can save the case.  And this will just store the data of parameters ab, in case ab.data:

 

Now closing the app, and restarting it, we can load this case again.  This will result in the following screen shot:

 

Note:

  • The parameters a and b got their values, because they were stored in the case.
  • The parameter c got its value, because it is a defined parameter.
  • The parameter d did not get a value; it was excluded from the case content type.

 

The following annotated code shows how to create case content types, and to select them for both WinUI and WebUI applications.

 

  1. s_cc := ( Main_CaseContentType - AllDefinedParameters ) * ( AllSets + AllParameters );

    • This line is assigning the set s_cc which is the result of the set difference operation between Main_CaseContentType and AllDefinedParameters, and then the set intersection with the union of AllSets and AllParameters. Essentially, it’s creating a set of all parameters and sets that are in Main_CaseContentType but not in AllDefinedParameters.
  2. s_cc -= 's_cc' ; ! Do not store this control set itself in cases.

    • This line is removing the set s_cc from itself. It’s ensuring that the control set s_cc is not stored in the cases.
  3. s_cc -= 'd' ; ! To show what happens when data is not stored in a case.

    • This line is removing the set d from s_cc. It’s demonstrating what happens when a particular set of data is not stored in a case.
  4. AllCaseFileContentTypes += 's_cc' ;

    • This line is adding s_cc to the set AllCaseFileContentTypes. It’s updating the types of content that can be stored in a case file.
  5. CurrentCaseFileContentType := 's_cc' ;

    • This line is setting the current case file content type to s_cc. It’s specifying that the current case file should contain the type of content defined by s_cc.
  6. webui::CaseFileContentType := s_cc ;

    • This line is setting the case file content type for the WebUI to s_cc. It’s allowing the WebUI DataManager to have the flexibility to select identifiers to be saved.

In summary, this code is about managing the types of content that can be stored in a case file, both for the WinUI and the WebUI. It provides flexibility in selecting which identifiers to save, and demonstrates what happens when certain data is not stored in a case. The WebUI DataManager offers this flexibility via the identifier webui::CaseFileContentType.

 

Please find attached the project I used to create the above screen shots - and for the text I had some help from copilot 

See also: 

 


0 replies

Be the first to reply!

Reply


Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator