KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Embedding a 4DBKVarSet command within a 4DBKVar command
PRODUCT: 4D Business Kit | VERSION: | PLATFORM: Mac & Win
Published On: February 28, 2003
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

The purpose is to use a built-in variable using the 4DBKVar command to set another built-in variable using the 4DBKVarSet command. If you ever have the need to generate dynamic variables to hold data on your Web page, you can use this tech tip to help manage the setting of dynamic variables with dynamic data. Below is an example of a loop, where the loop will execute a number of times based on the size of the current selection. This loop uses the counter variable VL01, to set a text variable VT0 (whatever VL01 is at this iteration through the loop).


<!--#4DBKLoop/VL01,1,4DBKSelectionSize-->

<!--#4DBKVarSet/VT4DBKVar/VL01=4DBKField/L01-->
<!--#4DBKRecordNext-->

<!--#4DBKEndLoop/VL01-->


For example: If the loop is in the third iteration, which means that the variable VL01 is equal to 3, we will use the command 4DBKVarSet to set the variable (for this iteration) VT03 equal to whatever 4DBKField/L01 is set to. This simple example demonstrates the flexibility of the 4DBK commands, allowing developers to embed a 4DBK command within a 4DBK command or variable.