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.
-
s_cc := ( Main_CaseContentType - AllDefinedParameters ) * ( AllSets + AllParameters );
- This line is assigning the set
s_cc
which is the result of the set difference operation betweenMain_CaseContentType
andAllDefinedParameters
, and then the set intersection with the union ofAllSets
andAllParameters
. Essentially, it’s creating a set of all parameters and sets that are inMain_CaseContentType
but not inAllDefinedParameters
.
- This line is assigning the set
-
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 sets_cc
is not stored in the cases.
- This line is removing the set
-
s_cc -= 'd' ; ! To show what happens when data is not stored in a case.
- This line is removing the set
d
froms_cc
. It’s demonstrating what happens when a particular set of data is not stored in a case.
- This line is removing the set
-
AllCaseFileContentTypes += 's_cc' ;
- This line is adding
s_cc
to the setAllCaseFileContentTypes
. It’s updating the types of content that can be stored in a case file.
- This line is adding
-
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 bys_cc
.
- This line is setting the current case file content type to
-
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.
- This line is setting the case file content type for the WebUI to
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:
- https://documentation.aimms.com/language-reference/data-communication-components/data-initialization-verification-and-control/working-with-the-set-allidentifiers.html#working-with-the-set-allidentifiers
- https://documentation.aimms.com/webui/webui/data-manager.html
- https://documentation.aimms.com/user-guide/data-management/case-management/working-with-selections-of-identifiers.html