Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Plant SCADA

Generic List Vertical Genie

  • Last UpdatedJul 18, 2023
  • 3 minute read

Genie Name: genericlist_v
Genie Library: sa_controls
System Project: SA_Controls

The Generic List Vertical Genie (named "genericlist_v") allows you to display a custom generated list of information on a page in a pre-defined format with a header row and scroll bars. It is a variation of the Generic List Genie. It differs as it generates a list with no header row and just a vertical scroll bar.

Generic List Vertical Genie Properties

Complete the following properties for the Genie in the Genie Properties dialog box.

  • AN: This is an automatically-generated unique ID for the Genie object.

  • Name: Optional. If you need to reference the Genie at runtime using Cicode, specify a unique name.

Generic List Vertical Genie Parameters

Select the Genie and double-click on it to view its parameters. The parameters are used as described in the table below:

Parameter

Description

AN

This is automatically populated and matches the AN in the Genie Properties dialog box. This cannot be modified.

GenericListFillFunction

Specify the user Cicode function to be called at runtime to populate the list by passing the list’s AN to the function. The function needs to retrieve the data to be displayed. For example, AlarmPage_FillResponse.

Generic List Vertical Genie Page Properties

For these Genies to work at runtime, they require some arrays to be pre-configured before animation begins. In the Page Properties dialog box, Events tab, select the following event options and specify the required Cicode command.

Parameter

Description

Example

On Page Entry

This code initializes the list array to be populated when the page is displayed.

FUNCTION ListInfo_Init()

On Page Exit

When the user exits the page, clear the information stored in the array.

FUNCTION ListInfo_Exit()

Example - Clear a list array on exit

FUNCTION ListInfo_Exit()

//Clear Equipment List

INT hEquipRefArray = PageGetInt("__EquipRefArray");

ArrayDestroy(hEquipRefArray);

ArrayDestroyByAn(DspGetAnFromName("MyList"));

Debug_Trace("ReferenceInfo", "ListInfo_Exit", "Closing Infoe_Default page.", TRACE_Information);

END

Example - Initialize a list array

FUNCTION ListInfo_Init()

INT hEquipRefArray;

INT nListAN = DspGetAnFromName("MyList");

INT nListHeight = 160;

INT nListRowHeight = 24;

INT nListWidth = 370;

INT nListCreatedFlag = 0;

STRING sFontPostfix = "";

STRING sResolution = "HD1080";


Debug_Trace("ListInfo", "ListInfo_Init", "Initializing Info_Default page.", TRACE_Information);


hEquipRefArray = ArrayCreate("EquipRef_" + nReferencesListAN:#, 5, 1000); // Max of 1000 equip references

PageSetInt("__EquipRefArray", hEquipRefArray); //Cache the array handle


_ArrayView_Initialize(); //Initialize the array


nListCreatedFlag = GenericListCreate(nListAN, nListWidth-14, nListHeight , nListRowHeight, 1, "SideEquipRef", DspFontHnd("SA_AlmRow" + sFontPostFix), DspFontHnd("SA_AlarmHeaderB" + sFontPostFix));

ArraySetIntByAn(nListAN, 5, 1, ARRAY_INFORMATION_ROW, 2);


Debug_Trace("ListInfo", "ListInfo_Init", "List_Default page is initialized with " + nListCreatedFlag:#, TRACE_Information);

END

Example - Populate list

FUNCTION ReferenceInfo_GetData(INT nListAN, STRING sEquipmentContext)

INT hSession;

INT nRecords;

INT nStatus;

INT nRow;

INT nLength;

INT nOffset;

INT hModel = PageGetInt("__EquipRefArray");

INT iArrayRow = 1;

STRING sFilter;

STRING sFields = "REFCLUST,REFEQUIP,REFITEM,REFCAT"

STRING sRefCategory;

STRING sRefCluster;

STRING sRefEquipment;

STRING sRefItem;

STRING sEquipment;

STRING sRefEquipItem;

STRING sRefItemValue;

IF (sEquipmentContext <> "") THEN

nLength = StrLength(sEquipmentContext);

nOffset = StrSearch(0, sEquipmentContext, ".")

sEquipment = StrRight(sEquipmentContext, nLength - nOffset - 1);

sFilter = "EQUIP=" + sEquipment;

Debug_Trace("ReferenceInfo", "ReferenceInfo_GetData", "Populating the equipment reference for " + sEquipment, TRACE_Information);

hSession = EquipRefBrowseOpen(sFilter, sFields);

IF (hSession <> BAD_HANDLE) THEN

nRecords = EquipRefBrowseNumRecords(hSession);

IF nRecords > 0 THEN

nStatus = EquipRefBrowseFirst(hSession);

FOR nRow = 0 TO (nRecords - 1) DO

sRefCategory = EquipRefBrowseGetField(hSession, "REFCAT");

sRefCluster = EquipRefBrowseGetField(hSession, "REFCLUST");

sRefEquipment = EquipRefBrowseGetField(hSession, "REFEQUIP");

sRefItem = EquipRefBrowseGetField(hSession, "REFITEM");

sRefEquipItem = sRefEquipment + "." + sRefItem;

sRefItemValue = TagRead(sRefEquipItem, 0, sRefCluster);

SleepMS(10);

ArraySetInt(hModel,0,0, iArrayRow);

ArraySetString(hModel, sRefCluster, 1, iArrayRow);

ArraySetString(hModel, sRefEquipItem, 2, iArrayRow);

ArraySetString(hModel, sRefItemValue, 3, iArrayRow);

ArraySetString(hModel, sRefCategory, 4, iArrayRow);

iArrayRow = iArrayRow + 1;

EquipRefBrowseNext(hSession);

END

END

EquipRefBrowseClose(hSession);

END

END

IF (nRecords <= 0) THEN

FOR nRow = 0 TO ArrayGetInfo(hModel, 1) DO

ArraySetInt(hModel,0,0, iArrayRow);

ArraySetString(hModel, "", 1, iArrayRow);

ArraySetString(hModel, "", 2, iArrayRow);

ArraySetString(hModel, "", 3, iArrayRow);

ArraySetString(hModel, "", 4, iArrayRow);

//iArrayRow = iArrayRow + 1;

END

END

ArraySetInt(hModel, iArrayRow, 0, 0);

END

See Also

Configure a Genie

Controls Genie Library

In This Topic
TitleResults for “How to create a CRG?”Also Available in