SCRWrite() Function Writes Wrong Value


 

The SCRWrite() function enforced template and field size limits when writing data into screen fields. The SCRWrite() function transfers information into the screen field as if an operator had typed the equivalent key-strokes into the field.

 

These enforcement conditions ensure that data written into fields by scripts cannot contain illegal characters or entries that would not have been allowed if an operator had attempted to type the entry into the field manually.

 

generate/mistake.gif This has particularly important consequences for small fields and numeric fields. The data written into the field may not be what you expect!

 

Field data will be truncated from the right side, if the data written to the field does not fit. Any character that is not accepted by the field will be ignored.

Example 1

With a field size of 10 characters:

 

SCRWrite("Myfield", "This is a test")

 

Will place "This is a t" into the field Myfield. Always write data that will fit into the field.

Example 2

Numeric fields can cause problems especially if "floating point" numbers are written into numeric fields without decimals. Round numeric fields to zero decimals if you write them into fields which do not support decimal places:

 

SCRWrite("MyCalc", Round(MyVar, 0))

 

Note that CAPITAL Business Script may convert integer numbers into floating point values as the product of a division, even if the decimal portion of the number is .0

This can cause the incorrect number value to be written to the field.

 

21/03/2001



C:\FORHELP5\htmlgifs\home.gif