This command activates a TTASDataGrid object on the form. It is appropriate when you are using the data grid for an actual file instead of an in-memory array. When you are accessing an in-memory array you would use WLISTM.
WLISTF f/c/e | Required - The name of the TTASDataGrid object on the form |
SETUP | This option would be used when you are first specifying the file, key, etc. Otherwise, you can use one of the display options below and you can reset any of the options originally set here. When this is called the first time certain setup routines are called in the grid and need not be called again. |
CLOSE | Use this option to remove all the rows from the grid and disconnect the grid from the file. This would only be used if you are going to change the columns from one WLISTF command to another. A good example of this is in WTASDATAM, where the user can close the current file and open another. |
FNUM f/c/e | This is the file handle/number value that is returned in the OPENV command. If this is during the SETUP process then this is Required option. |
NOTE: In this case you DO NOT preface the file number/handle field with the '@' symbol.
KEY key_expr | Set this to the appropriate value to list the records in the file in the correct order. If this is during the SETUP process then this is Required option. |
START f/c/e1,f/c/e2,...,f/c/ex The value to use as the beginning record. This is similar to doing a FINDV (Find Record) before the command. If the index you're searching on has multiple segments you may list the proper value for each segment, separating them with commas. This will allow you to specify the exact type for each of the segments. For example, suppose you're searching on an index that has two segments: a 5 character alpha and an I type field. Each record you want has the same alpha but the I field will change, and is in order. In the first record the I type field has a value of 0. The following would find the first record for that group, if it exists:
start 'ABCDE',0!
Notice that we separate the values with a comma. The only requirement is that the values be of the same type (and size) as the segments in the key. In this case we put the I type constant specifier (!) after the 0 to make sure that it is passed as an I type field.
FOR lexpr | You would use this option to restrict the records displayed in this command. If the expression did not resolve to .TRUE. the record would not be displayed. Any legal expression that resolves to .TRUE. or .FALSE. can be used. Only those records that will resolve to .TRUE. will be displayed. This option will test all the records in the file. |
An example of a legal expression would be:
... FOR (x=100) .and. (y=200) ...
Note : You can use the FOR to help you display the progress bar. example for ChkFilter() don't forget to set the min and max values on the progress bar.
func ChkFilter
'@pbRecCount.Position' = RecCntr // This updates progress bar
(x=100) .and. (y=200) ...
Ret .t.
WHILE lexpr | This option also RET .t.o restricts the records displayed. However, the first time the expression resolves to .FALSE., the program stops checking the records in the file. Here's the benefit of this option: if the program is displaying records in a certain order (by a specific key) and the expression returns .FALSE. then the program knows that all the appropriate records have been displayed and there is no need to continue. For example: You want to display all the invoice records for a specific customer. The first record for that customer is found in the invoice file either by using the start_value option within this command, or through the FINDV (Find Record) command before executing this command. Then the WHILE expression would be: |
INV_CUST_CODE = CUSTOMER_CODE
(This assumes that there is a field called INV_CUST_CODE in the invoice file and a like field in the customer file called CUSTOMER_CODE. The KEY option must be set to the proper value so that the records are read in CUSTOMER_CODE order, or you must have set the SRCH command previous to this command.) When the first invoice record for the next customer is read the program will stop deleting records.
NOTE: You must either specify a START value or have a record active before this command is executed. If you don't you may only find a single record before the WHILE kicks in.
display | REDISPLAY - Redisplay starting with the first visible record on the grid and continuing from there. |
REDISPLAYFROMTOP - Redisplay starting with the first record in the file.
REDISPLAYFROMEND - Redisplay starting with the last record in the file.
UPDATECURRENT - Refresh all the columns in the active record, but this doesn't get the record from disk.
REDISPLAYCURRENT - This assumes that you've changed an index or some other option. It will move the current row to the top of the visible grid and will display all the records that come after it. NOTE: If there are not enough rows to fill the grid and there are rows above what would normally be the top, those rows will be displayed and the nominal top will be moved down. The row cursor will be moved down also.
REDISPLAYACTIVE - This would be used if you have made a record active and want to redisplay the grid based on that record. It will be placed at the top of the visible grid and all records that follow it will be displayed. NOTE: If there are not enough rows to fill the grid and there are rows above what would normally be the top, those rows will be displayed and the nominal top will be moved down. The row cursor will be moved down also.
REFRESHRECORD - Refresh the active record by restoring it from the disk and redisplaying that record only. This also locks the record.
COMMENTS
You will need to execute this command at least once to activate a TTASDataGrid. Once that grid is active all other changes can take place due to the user moving from row to row or through the effect of the DATA_GRID command.
EXAMPLE
A very good example of this command and the DATA_GRID command is WTASDATAM. The source file (WTASDATAM.SRC) should be in the \TAS7 subdirectory depending on where you installed TAS Professional.
Advanced Grid Sample Code
You can also add other information in a wlistf grid from other tables or even add memory fields to the grid and do math as you go...
On your grid add a Column this has to be the first column in the grid. in the data field property place the Find_Fld.
I thought for a second and maybe this could be an extra field not sure at this time just thought I would mention this. If you find this works as well let me know..
Now in your code define a field called Find_Fld
define Find_Fld type A size 1 value FindMore() //Note see value in the defined Field command
Now Create a function called FindMore
Func FindMore
// Here you can find records in other tables or even do math...
findv M fnum MTICMSTR_hndl value BKIC.PROD.CODE // this would link the bkicmstr table to the mticmstr table
// or
define newcol type N size 12 dec 2
NEWCOL = bkic.prod.uoo + bkic.prod.uoso
// So if you add a Column to your grid for the newcol it will now display in your grid !
ret ' ' // return a blank...
Now add the columns for this data to your grid and do your grid setup
wlistf 'testgrid' fnum bkicmstr_hndl setup
//every record that is read into the grid now will be linked by the find_Fld in the grid and the findmore function.
Page url: http://www.cassoftware.com/tas/manual/datagridlistfile.htm