Command

This chapter introduces some commands related to LOGO! data access protocol.

Get

To get the data in your webpage, you need to do the following two steps. LOGO!’s JavaScript framework call the callback function When BM data updates.

  1. Create a server_binding element according to the instruction in Define a server_binding element .

  2. Implement the declared callback function.

See an example as below:

var myCallback = function myCallback() {

//get value from framework
var newValue = this.m_sValue;

//do your actions...
$("#myDiv").html(newValue);
}};

When the callback_function is called, the JavaScript framework receives a parameter DBRequest. By this parameter, you can get the server_binding emelent related information and the updated data as follow.

Property

Parameter

DBRequest.m_nAddress

address

DBRequest.m_nLength

length

DBRequest.m_nRange

range

DBRequest.m_nType

type

DBRequest.m_oSrcElement

server_binding element

DBRequest.m_sShowParam

show_param

DBRequest.m_sValue

value

Set

You need to write your own JavaScript code to implement a set query for a server_binding element,

  1. Create a DBRequest object for the server_binding element.

  2. Assign a value to DBRequest by SetValue method.

  3. Release a set query by SetQuery method.

  4. Check the m_iSetPendingFlag member to make sure the SetQuery is complete. The ture value means SetQuery is pending while the false value means SetQuery is completed.

You can refer to the example below.

function DBRequestTest() {
var oRequest = new DBRequest(document.getElementById("myDiv"));
oRequest.SetValue(true);
if (oRequest.SetQuery()) {
//success
return true;
}
//fail:
return false;
}

Note

You should call the function DBInit() in the page initializing routine, which initializes the data binding environments. Otherwise, the refresh framework cannot work.

Two global methods are also provided to help you easily read and submit data if your defined Div fully compiles with the standards:

_getFormatValue(bindObj, value); //Format real-time value with binding info
_doSetValue(divID, value); //do submit