4D v14

Video script

Home

 
4D v14
Video script

Video script  


 

 

In this video, we're going to learn how to program BLOBs and see how they interact with variables.

BLOBs allow you to store and retrieve all kinds of information.

Let’s use a simple example, say, storing variables. First let's create a method and then we are going to:

  • assign values to three input variables, and three output variables
  • initialize the BLOB and the reading position in the BLOB
  • assign values to the variables
  • and transfer these variables to the BLOB.

The principle is to:

  • use the VARIABLE TO BLOB command
  • indicate the variable to process
  • the BLOB where you want to store it
  • and the position where you want to store the variable in the BLOB.

The PositionInBlob variable works as both an input and output variable, in other words:

  • It indicates where you want to store the variable beforehand
  • And after the command has been executed, this variable contains the position in the BLOB just after the variable so that you can then store the following elements.
  • Once the data is stored in the BLOB, we can do a series of processing and then extract data from the BLOB by writing this:
    We redefine the starting point in the BLOB to position 0.
    We're going to extract from the BLOB the first variable that was entered.
  • Then the 2nd and the 3rd.
  • Normally, when we have finished using a BLOB, we can erase it by setting its size to 0.

We're going to trace this method to see how it fills the BLOB and how it restores the variables.

At this point:

  • All the initializations have been done.
  • The BLOB is empty.
  • When we move to the 1st row, the BLOB contains a certain number of bytes.
  • And gradually it is filled.

To extract data from the BLOB:

  • We go back to position 0 in the BLOB.
  • Then we extract the integer value
  • The date
  • And the text that were stored.
  • Then we empty the BLOB.

This simple example helps us understand the entry and removal of data in a BLOB.

We could store results from statistical arrays in a BLOB so that we can use them again later on.
So we will:

  • Create a BLOB button
    (usually you have to go put it in the XLIFF file)
  • And in this button, we'll create a BLOB
  • And transfer the 2 arrays.

Later, when we want to retrieve the contents of the arrays, we'll need to program this as follows:

  • Initializing the first array
  • Then the other one
  • Setting the position in the BLOB
  • Retrieving both arrays from the BLOB.

During execution:

  • Our arrays contain 7 elements,
  • The BLOB is empty
  • We load the BLOB with the information from the arrays.

Then when we want to retrieve the BLOB contents later on:

  • We start with 2 empty arrays
  • We go to the beginning of the BLOB
  • Then we reload the arrays (Technicians and then Interventions)

 
PROPERTIES 

Product: 4D
Theme: BLOBs

 
ARTICLE USAGE

Self-training ( 4D v13)
Self-training ( 4D v14)