Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

Const Table sample shows anonymous field name


kcopeland Jun 30, 2016 04:48 PM

Cr1000

OS29

When I sample a constant declared in a const table, the field name in the final storage table shows "anonymous".  I was trying to describe this problem to Marco and Kenny but my email would not go through to them.  Please use this code to test the bug.

ConstTable
  Const Serial_number = 12345
EndConstTable
 
'Define Data Tables.
DataTable (Meta,1,9999) 'Set table size to # of records, or -1 to autoallocate.
  Sample (1,Serial_number,String)
EndTable
Public x
'Main Program
BeginProg
  CallTable Meta
 Scan (1,Sec,0,0)
   x=1
 NextScan
EndProg

Thanks

Kyle


GaryTRoberts Jun 30, 2016 05:19 PM

Kyle,

  We thought this was a bug origianally and sent it to Engineering.  Here is the information they came back with:

The field Serial_number is not showing up because Serial_number is defined as a constant. This causes the evaluation of serial_number in the Sample instruction to be evaluated as an expression. The help explains that expressions result in field names of AnonymousN.

When parsing a program, when a parameter is encountered, the constants list is searched and if the name used in the parameter location matches a constant name (either predefined or user defined), the expression or value of that constant is used in place of that parameter.

So what you are really saying is:

 

Sample(1,12345,String)

 

The 12345 is an expression that results in the Anonymous1 field naming in the table.

 

This is working as expected.

 

 Engineering


Ken Conner Jul 6, 2016 05:40 PM

Kyle,

You can get around this by using the FieldNames() instruction.

Const MyConst = "ASCII"


DataTable (Test,1,-1)
  Sample (1,MyConst,String)
  FieldNames ("MyConst")
EndTable

BeginProg
  Scan (1,Sec,0,0)
    CallTable Test
  NextScan
EndProg

Log in or register to post/reply in the forum.