Log In    |    Knowledge Base    |    4D Home
Tech Tip: Proceduraly display the contents of a field if it exists
PRODUCT: 4D Business Kit | VERSION: 2.x | PLATFORM: Mac & Win
Published On: July 29, 2003

If you would like to display the fields values for a product, if the field is available, you can write this snippet of code to loop through the a list of fields you wish to display. 4D Business Kit will search the parameter string for the string "4DBK" and will resolve the 4DBK variable accordingly, even if the string appears within another 4DBK field variable. To demonstrate this, the second line below is a perfect example.

T0<!--#4DBKVar/VL01--> = <!--#4DBKField/T04DBKVar/VL01-->

Within the "If" statement, we are testing whether the 4D Business Kit Items field "T04DBKVar/VL01" contains a value or not. The value of the variable "4DBKVar/VL01" depends on the iteration of this loop. If the loop value is 1, then "T04DBKVar/VL01" is resolved to "T01". The If statement then becomes ""

You can test this loop out by copying this code into your item description page (where one item is currently in the selection set.) You will first need to make sure that there exists values for the fields T01 through T03.