How to move data around in ZIM

How to move data around in ZIM

Welcome to our Knowledge Base

Documentation | Blog | Demos | Support

< All Topics
Print

How to move data around in ZIM

ZIM is a natural language, Integrated, Full Stack, 4GL Object Oriented, Framework (FOOF) that used an Entity Relationship Database to store and process the Data. What this means in simple terms is that most of the hard coding is already done for you. You can now focus on the “intelligent” part of your application. ZIM has a number of tools to move data from one Object to another in just a few lines of code. ZIM’s Objects created based on a powerful Metadata Pointing Layer. In other words, when you move the data between ZIMs Objects, you are actually only moving the Metadata Pointers, not the actual data. This is another very powerful and unique future of ZIM. We call it “SET Processing”. This is a great place to start.

Adding Data to an Entity

One you have defined an Entity Object in the IDE. Try adding some data to the Entity from the ZIM Command Prompt. Here is an example. Assuming you’ve made an Entity called Customers with a single field called CompanyName.

add 1 Customers let CompanyName = "ZIM-X" -> CustomerSet

Lets take a look at what we did. “add” this is similar to “insert” in SQL. “1” for 1 record. “Customers” is the name we gave to our Entity Object. An Entity is known as a Table in other systems. “let” Let is a ZIM command that tells ZIM that you are about to assign a value to an Object such as a field, form.field, variable or Temporary Object (SET). In this case we are going to assign the value “ZIM-X” to the field “CompanyName”. Next we use a ZIM ARROW “->“. This command tells ZIM to build a SET that will contain the Metadata Pointers to the new record being added to the Customers Entity Object. If you don’t use the ZIM ARROW “->” you will have to have to use another “find statement“.

Assuming you’ve added another field called PhoneNumber. ** Caution!! Sets <CustomerSet> are Temporary Objects and are available only during your current session. This means that when you close your ZIM Application or ZIM Developer Suite, the sets will all be destroyed. The next time you start ZIM, you will be able to use your sets again. You can even give them new definitions. However, you cannot change the definition of a set in the same session. This means that you need to use a new setname in the same session if you change your find or add statements.

add 1 Customers let CompanyName = "ZIM-X" PhoneNumber = "1234567890"-> CustomerNewSet

Adding a Program Document Object

ZIM uses Document Objects to store and run your custom code. Document Objects can be programs, processes, procedures, data, etc. In this case we are going to create a simple program to find customers, open a window and form and then it will place the Data on your new from. ZIM does not rely on punctuation things like SPACES or TABS at the beginning of each line. ZIM does rely on things like “\” the backslash to wrap code to the next line. Or “%” percentage sign to comment out a line.

procedure CustomerAPP() % The procedure name must be the same name as the document.

find all customers -> CustomerSet % we create a Temporary SET Object.

window open Window_00000 at center % we open the Window in the center of the screen.

form open CustomerForm % Open the From Object within ZIM.  You will not see it yet!!

change all CustomerFrom from CustomerSet % Add the SET Object to the Form Object.

While % create a loop that will stay alive until you press the X or Press ESC

form display input % Display the Window, Form and Data Objects on the Screen

case % Cases instruct ZIM to take action based on what the user does. 

when event.eventname = "Closed" or event.eventname = "Escape" % Zim Events

break % Break the Loop when the user presses X or ESC.

endcase % End the case section.

endwhile % End the loop.

window close % Close the Window. The screen will disappear.

endprocedure % End the procedure.

Was this article helpful?
5 out of 5 stars

1 rating

5 Stars 100%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *

pt_BRPortuguese