10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ArraysThe inserted row is blank because the rowobject parameter is not specified.This technique is especially useful if you display an array in a table field andwant the user to enter new data in a particular position in the array.If you set rowobject to null, 4GL creates the row number in the array, but noobject is associated with the new row. This feature provides useful programcontrolcapabilities but should not be used if the array is displayed by a tablefield.Assign the Contents of One Array to Another ArrayAssume that you have an array variable, custtable, that contains customeraddresses and an empty array variable, addresses. The following statementassigns the contents of custtable to addresses:addresses = custtable;This statement does not create two distinct objects, but rather two arrayvariables that point to the same set of objects, that is, to the same array. Bothcusttable and addresses now reference the same array.Create a Populated Array by Duplicating an Existing ArrayIf you want two separate array variables so that you can modify the data inone array without affecting the other, you can create a second copy of thearray by using the Duplicate method defined for the Object system class.You can make an exact duplicate of an array, placing a reference to the newarray in a new reference variable, provided the new reference variable is of thesame class, or a superclass of, the array being copied.The following example creates a new array object called array2 which is anexact duplicate of array1:declarearray1 = array of myclass;array2 = array of myclass;enddeclarebegin/* load values into array1 *//* then duplicate array1 */array2 = array1.Duplicate();...Allow the User to Append to a Table FieldA table field may or may not allow the user to add new rows at the bottom ofthe array. For more information about this, see How You Can Append Rows toEnd of Table Field (see page 243).218 <strong>Programming</strong> <strong>Guide</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!