27.3.2.4.4 GetValue

 

Get current value of the specific tag.

 

Syntax

viewdll.dll

int VD_API VdBroadWinGetValueText(struct VIEWDLL_ID *id, char *text, int *alm);

Bwdllobj

Public Function GetValue(id As Object, value as String, alm as Integer) As Integer

C#

Integer GetValue(Object id, ref String value, ref Integer alm);

 

Parameters

id

[in] Specific tag ID that return by GetID() function with a specific tag name.

value

[out] the value of specific tag in string format.

alm

[out] indicate the tag is used as an alarm or not.

 

Return Value

Type: Integer

Return the tag type.

1 or -1 means the tag type is analog.

2 and -2 means the tag type is discrete.

3 and -3 means the tag type is text.

 

Remarks

 

C# Sample Code

private void btnGet_Click(object sender, EventArgs e)

{

    object Id = ViewDllWrap.GetId(tbTagName.Text);

    if (Id == null)

    {

        MessageLog("GetId() Failed. Return Code: "

            + ViewDllWrap.ReturnCode.ToString());

        return;

    }

    string text = "";

    int alm = 0;

    int code = ViewDllWrap.GetValue(Id, ref text, ref alm);

    if (code == 0)

    {

        MessageLog("GetValue() Failed. Return Code: "

            + ViewDllWrap.ReturnCode.ToString());

        return;

    }

    tbResult.Text = text;

    switch(Math.Abs(code))

    {

        case 1: // analog

            tbCode.Text = "Analog";

            break;

        case 2: // discrete

            tbCode.Text = "Discrete";

            break;

        case 3: // text

            tbCode.Text = "Text";

            break;

        default:    // undefined

            tbCode.Text = "Undefined";

            break;

    }

    if(alm == 0)

    {

        tbAlarm.Text = "Not";

    }

    else

    {

        tbAlarm.Text = "Alarm";

    }

}