Ask Reuben

+tn_0

What is the meaning of +tn_0?

Where does +tn_0 come from?

You are likely to encounter “+tn_0” in one of at least three places…

In a compiled .42f you may see it as the value of the tabName attribute for a Table node (you will also likely note two RecordView nodes, differentiated by the value of the tabName attribute, neither of which are +tn_0) …



For this form, you will encounter the +tn_0 value in the AUI Tree as the value of the tabName attribute of the Table node …



If you ever look at the values of your stored settings, you may see +tn_0 as the key value for a tables stored settings …



The root cause of seeing a value of +tn_0 like the above is that there is a difference in the …

  • the order of the table columns in the LAYOUT section
  • the order of the columns in the ATTRIBUTES section
  • the order of the SCREEN RECORD of the INSTRUCTIONS section.

It should be noted that there is nothing wrong in these orders being different.  The only thing that matters for the successful running of the program is that the order in the SCREEN RECORD matches the order of the 4gl array as noted here and here.

So to see for yourself where the +tn_0 originates, do this exercise, take a small example form as below.


LAYOUT
TABLE
{
[f01      ][f02      ][f03      ]
}
END
END
ATTRIBUTES
EDIT f01 = formonly.field1, TITLE="Column 1";
EDIT f02 = formonly.field2, TITLE="Column 2";
EDIT f03 = formonly.field3, TITLE="Column 3";
INSTRUCTIONS
SCREEN RECORD scr(field1, field2, field3)

Compile this form file to produce a .42f.  Open up the .42f in a text editor and note the value of  the tabName attribute of the Table node and note how many RecordView sections there are (1).  You should see something like the following …


<?xml version='1.0' encoding='UTF-8'?>
<Form name="play" build="4.01.05" width="33" height="1">
  <Grid>
    <Table gridWidth="33" gridHeight="1" pageSize="1" tabName="scr">
      <TableColumn name="formonly.field1" colName="field1" fieldId="0" sqlTabName="formonly" text="Column 1" tabIndex="1">
        <Edit width="9"/>
      </TableColumn>
      <TableColumn name="formonly.field2" colName="field2" fieldId="1" sqlTabName="formonly" text="Column 2" tabIndex="2">
        <Edit width="9"/>
      </TableColumn>
      <TableColumn name="formonly.field3" colName="field3" fieldId="2" sqlTabName="formonly" text="Column 3" tabIndex="3">
        <Edit width="9"/>
      </TableColumn>
    </Table>
  </Grid>
  <RecordView tabName="formonly">
    <Link colName="field1" fieldIdRef="0"/>
    <Link colName="field2" fieldIdRef="1"/>
    <Link colName="field3" fieldIdRef="2"/>
  </RecordView>
</Form>

Now swap f02 and f03 in the LAYOUT section and recompile the .per.  Open the .42f in  a text editor.  Note the value of the tabName attribute of the Table node is now +tn_0 and there are two RecordView sections.  …


<?xml version='1.0' encoding='UTF-8'?>
<Form name="play" build="4.01.05" width="33" height="1">
  <Grid>
    <Table gridWidth="33" gridHeight="1" pageSize="1" tabName="+tn_0">
      <TableColumn name="formonly.field1" colName="field1" fieldId="0" sqlTabName="formonly" text="Column 1" tabIndex="1">
        <Edit width="9"/>
      </TableColumn>
      <TableColumn name="formonly.field3" colName="field3" fieldId="2" sqlTabName="formonly" text="Column 3" tabIndex="2">
        <Edit width="9"/>
      </TableColumn>
      <TableColumn name="formonly.field2" colName="field2" fieldId="1" sqlTabName="formonly" text="Column 2" tabIndex="3">
        <Edit width="9"/>
      </TableColumn>
    </Table>
  </Grid>
  <RecordView tabName="formonly">
    <Link colName="field1" fieldIdRef="0"/>
    <Link colName="field2" fieldIdRef="1"/>
    <Link colName="field3" fieldIdRef="2"/>
  </RecordView>
  <RecordView tabName="scr">
    <Link colName="field1" fieldIdRef="0"/>
    <Link colName="field2" fieldIdRef="1"/>
    <Link colName="field3" fieldIdRef="2"/>
  </RecordView>
</Form>

Repeat the exercise, only this time swapping “field2” and “field3” in the ATTRIBUTES section …


<?xml version='1.0' encoding='UTF-8'?>
<Form name="play" build="4.01.05" width="33" height="1">
  <Grid>
    <Table gridWidth="33" gridHeight="1" pageSize="1" tabName="+tn_0">
      <TableColumn name="formonly.field1" colName="field1" fieldId="0" sqlTabName="formonly" text="Column 1" tabIndex="1">
        <Edit width="9"/>
      </TableColumn>
      <TableColumn name="formonly.field3" colName="field3" fieldId="1" sqlTabName="formonly" text="Column 2" tabIndex="2">
        <Edit width="9"/>
      </TableColumn>
      <TableColumn name="formonly.field2" colName="field2" fieldId="2" sqlTabName="formonly" text="Column 3" tabIndex="3">
        <Edit width="9"/>
      </TableColumn>
    </Table>
  </Grid>
  <RecordView tabName="formonly">
    <Link colName="field1" fieldIdRef="0"/>
    <Link colName="field3" fieldIdRef="1"/>
    <Link colName="field2" fieldIdRef="2"/>
  </RecordView>
  <RecordView tabName="scr">
    <Link colName="field1" fieldIdRef="0"/>
    <Link colName="field2" fieldIdRef="2"/>
    <Link colName="field3" fieldIdRef="1"/>
  </RecordView>
</Form>

Repeat the exercise, this time swapping “field2” and “field3”  in the INSTRUCTIONS section …


<?xml version='1.0' encoding='UTF-8'?>
<Form name="play" build="4.01.05" width="33" height="1">
  <Grid>
    <Table gridWidth="33" gridHeight="1" pageSize="1" tabName="+tn_0">
      <TableColumn name="formonly.field1" colName="field1" fieldId="0" sqlTabName="formonly" text="Column 1" tabIndex="1">
        <Edit width="9"/>
      </TableColumn>
      <TableColumn name="formonly.field2" colName="field2" fieldId="1" sqlTabName="formonly" text="Column 2" tabIndex="2">
        <Edit width="9"/>
      </TableColumn>
      <TableColumn name="formonly.field3" colName="field3" fieldId="2" sqlTabName="formonly" text="Column 3" tabIndex="3">
        <Edit width="9"/>
      </TableColumn>
    </Table>
  </Grid>
  <RecordView tabName="formonly">
    <Link colName="field1" fieldIdRef="0"/>
    <Link colName="field2" fieldIdRef="1"/>
    <Link colName="field3" fieldIdRef="2"/>
  </RecordView>
  <RecordView tabName="scr">
    <Link colName="field1" fieldIdRef="0"/>
    <Link colName="field3" fieldIdRef="2"/>
    <Link colName="field2" fieldIdRef="1"/>
  </RecordView>
</Form>

In each case, the tabName attribute of the Table node is now “+tn_0” and not “scr”., and there are two RecordView nodes instead of one.  If there are multiple tables, you may see +tn_1, +tn_2 etc.

This is an internal mechanism and is not normally something to worry about, however it will manifest when the value of the tabName attribute of the Table node is shown or used at run-time.  This includes in the AUI Tree, and as the key used for changes to the table remembered by Stored Settings.

In summary, if you see “+tn_0” appearing anywhere, first place to look is in your form file (.per or .4fd).  Review each table and note the order of the columns in the TABLE section, in the ATTRIBUTES section, and the SCREEN RECORD section.  There is no formal requirement for the order to be the same between sections.