To continue with this content, please log in with your Data Access ID or create a new account.
Cancel Data Access ID
You may not be authorized to see this content. Please contact Data Access Europe for more information.
Cancel Data Access Europe
You are not authorized to see this content.
Cancel Data Access Europe
Next lesson:
Client Actions

Custom Controls

Lesson 6: Sending and Receiving Data

Things to keep in mind:

  1. The server and client communicate with each other using a uniform data structure
    • Complex data is serialized to a WebValueTree 
    • A WebValueTree is a recursive array of keys and values
    • Upon being received, the data can be deserialized back to a struct
    • Any simple parameters sent along with the data can be sent as strings
  2. On the server side – (de)serializing
    • First, define the structs
    • Then use the value tree struct tWebValueTree
      • ValueTreeSerializeParameter: serialize any struct
      • ValueTreeDeserializeParameter: deserializes any WebValueTree back to a struct
    • To send data, add an extra optional parameter to the DataFlex code
    • To receive the data from the client on the server, use the ptActionData property to get the data in DataFlex
    • Server - code example of sending data…
    • Server – code example for receiving data…
  3. On the client side – (de)serializing
  4. Use the df.sys.vt library
  5. Define the structure using JavaScript objects
  6. To deserialize a value tree use
    df.sys.vt.deserialize(tVT, tDef); 
  7. To serialize an object to a value tree use
  8. Alternatively, generate a reusable (de)serializer

  9. This method is more efficient whenever calls need to be repeated
  10. Client side – sending data
  11. To send data from the client to the server an extra optional parameter needs to be added to the JavaScript call
  12. To receive the data back in JavaScript use

  13. Client – code example of sending data
  14. Client – code example of receiving data