KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Updating references with WR PRINT in 4D Write 6.5
PRODUCT: 4D Write | VERSION: 6.5 | PLATFORM: Mac & Win
Published On: August 11, 2000
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

If you were using 4D Write version 6.0.x to print a 4D Write area for a selection of records (one print per record) and were using the WR PRINT command to do so, your code would have looked like this:

Copy and paste the following code example into your own 4D project:

ALL RECORDS([Table 1])
`Selecting all the records for Table 1
For ($i;1;Records in selection([Table 1]))
WR PRINT (My4DWriteArea)
`Printing the area
NEXT RECORD([Table 1])
End for

If you attempt to use the same method with version 6.5 of 4D Write, you will notice that references are not updated. For the area to be updated, you need to call the WR EXECUTE COMMAND command with the wr cmd compute references constant before actually printing the area. Your code should then look as follows:

Copy and paste the following code example into your own 4D project:

ALL RECORDS([Table 1])
`Selecting all the records for Table 1
For ($i;1;Records in selection([Table 1]))
WR EXECUTE COMMAND (My4DWriteArea;wr cmd compute references )
`Updating the values
WR PRINT (My4DWriteArea)
`Printing the area
NEXT RECORD([Table 1])
End for