This Reference Article gives tips on how to use GridField (GF) in CODESOFT (CS).
Note: This article is not a step-by-step instruction on how to create GridField. It assumes that you have some knowledge of CODESOFT and some understanding of GridField.
- Must Use CODESOFT Enterprise – GridField is only available in CODESOFT Enterprise Edition. You can find it in the Extended Objects button from the Creation tools (typically on the left hand of the main screen).
- Clear Default Data ASAP – When creating a new GridField, delete all of the default components in Body, Fonts, and Barcodes
- Use Duplicate to Save Time – You should start building GF in this order. To save time, use the Duplicate function to create additional sub-components that have similar configurations.
- Fonts: Create all the fonts and their variations you need to use in the GF.
- Barcode: Create all the type and format of barcodes you will need to use in the GF.
Grid Field and Grid Field Component Properties
- Set to ‘Manage Multiple Pages’ – Don’t forget the check the Manage multiple pages in the General tab. Users typically need this features when using Grid Field.
- Column Separator and Line Separator Settings MUST Match – When creating sub-component Grid in the Body component, make sure to match the Column separator and Line separator with those under Table lookup. Don’t forget to set the Default cell values.
Table Lookup Configuration
- SQL Statement Syntax is Critical – The SQL entry must contain everything you want to appear in the GF including separators and nothing more.
- GF Data Elements – Just because your GF has only 3 columns, it does not mean that the Table lookup entry can only contain 3 data elements. GF will accept any number of data elements.
- Data Sequence in SQL Statement Important – GF populates the data in the order specified in the SQL statement
- Use of Static Text in SQL – If you want a static text to appear in the GF, you must enter it in the SQL statement. Remember to use the Column Separator- the default is “|”
- Separators Must Be Set – Don’t forget to set Field separator string and Record separator string in the Data formatting tab.
- Relevant Records Setting – Set Relevant records in the Data formatting tab of the Table lookup to 0. This can cause GF only show one record out of many in the Preview window on that screen.
- Maximum Length Setting – Don’t forget to uncheck Maximum length check box in the Output tab.
Grid Field Cells
- Make a Cell for Each Data Element – Under the Grid sub-component, create Cell sub-components under Grid. Create as many Cell sub-components as the number of data elements from the Table lookup. Note: – You can have more cells then you have columns. Again, using Duplicate feature can save you time.
- Define “Interpret as” for Each Cell – For each of the Cell created, change the settings (Text, Barcode, Picture or Rich Text) so that GF can properly interpret the incoming data from Table lookup.
- Barcode Cells Should Not Use Human Readable – If the cell defined as Barcode only display the text, check to make sure that the Human (human readable) is set to None.
Select 'User ID|User Name|TX Type|' + TRANS.USER_NO, TRANS.USER_NAME, TRANS.TRANS_TYPE + '|Tx Date|Tx Sequence|Item Description', TRANS.TRANS_DATE, TRANS.TRAN_SEQ, TRANS.ITEM_DESC From TRANS Where TRANS.ITEM_NO = APPLICATION.DOCUMENT.[Key]
Note the line ‘User ID|User Name|TX Type|’ + TRANS.USER_NO, we insert the column headings directly into the data element. When Grid process this data, it separates the is data into 4 separated fields (cells) – User ID, User Name, Tx Type and value from TRANS.USER_NO. Note the use of column separator (“|”).
Same with the line TRANS.TRANS_TYPE + ‘|Tx Date|Tx Sequence|Item Description’, This time, we insert the column headings at the end of the data. We had to do this because the next data field TRANS.TRANS_DATE is not a text data, therefore, we cannot append static text to it.