Using getSelectedData

The method getSelectedData is a form grid control used to get all the currently selected (marked) records in the grid. This can be a usual command, but how can you use this information. Below is an example piece of code, based on the mouse double click control on a form that shows how you can extract the information from this method:

public int mouseDblClick(int _x, int _y, int _button, boolean _Ctrl, boolean _Shift)

{
int ret;
Struct struct;
array ColumHeaders, DataLines, LineData;
int LinesCount;
int LineIndex;
;

ret = super(_x, _y, _button, _Ctrl, _Shift);

struct = this.getSelectedData();

ColumHeaders = struct.value(struct.fieldName(1));
DataLines = struct.value(struct.fieldName(2));

LinesCount = DataLines.lastIndex();

for(LineIndex = 1; LineIndex <= LinesCount; LineIndex++)
{
LineData = DataLines.value(LineIndex);

info(strFmt(“Line No:%1 field 1(%2) field 2(%3)”, LineData.value(1), LineData.value(2), LineData.value(3)));
}
return ret;
}

This will display the line number and field names and values for the first two fields on the grid.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s