4D v14ビデオの内容 |
||
|
4D v14
ビデオの内容
ビデオの内容
In this video, we're going to learn about pointers and how to optimize their programming and make it generic. As we saw in the previous exercise, setting options for each action (query, order by, etc.) in the NAVIGATION_FUNCTIONS method can quickly become tedious. So, we need to set the action towards the table corresponding to the selected page. In that case, it’s easier to indicate table to be used just once at the beginning of the method. We can store this directive in a variable and then use this variable in the commands. Logically speaking, we can’t say that a variable is equal to a table; these objects are completely different and have completely different content as well. We’ve already learned that a variable can be an integer, number, text, picture, etc. It contains a value of the relevant type. A table isn’t “content” like a numeric value is. The solution is to use a variable of the pointer type. So we're going to set this variable, which is a local variable: C_POINTER($TablePointer) This variable exists in memory. Now to assign a value, we'll use the following type of syntax: $TablePointer:=->[INTERVENTIONS] So as we saw for variables, we have:
and, later on, wherever the Interventions table should have been used, we'll be able to replace it with this variable, that we'll need to "de-point" in this case. The advantage being that all the code is here, a simple copy-paste with only a change of table, can be replaced by these 2 same lines of code, provided that we have previously set the table to where it must point depending on the page number. So we have to get the code that we wrote earlier and here we indicate that:
That said, we no longer need to test the pages here and so it's no longer useful to have this duplicate program. We have a 1st program here that lets us:
The same principle applies for searches:
When we get here, the pointer will be a pointer to "Technicians" and so we will search in the "Technicians" table. The number of records found is the number of records found in the "Technicians" table. |
プロパティ
プロダクト: 4D ARTICLE USAGE
セルフトレーニング ( 4D v13) |