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.

Datatable name as a variable?


NLA_MV Mar 25, 2021 11:49 AM

Hi everyone

I'm wondering if it is possible to use a public variable to set a name for a data table. I tried whipping up the code found below but when compiling I get the following error: line 1: Warning: DataTableName declared but not used.


And of course when uploading to a logger the name of the data table is "DataTableName" but not "TEST" as I would like it to be.

Am I doing something wrong programming wise, or is this just not possible?

Public DataTableName = "TEST"
Public BatteryV

DataTable (DataTableName, 1, -1)
	DataInterval (0, 15, Sec, 10)
        Sample (1, BatteryV, FP2, 0)
EndTable

BeginProg
	Scan (1,Sec,0,0)
	  Battery(BatteryV)
		CallTable DataTableName
	NextScan
EndProg


JDavis Mar 26, 2021 04:20 PM

The data table structures need to be constant, including the table name.


NLA_MV Mar 29, 2021 11:41 AM

Dear JDavis, thank you very much! Changing from a Public (variable) to a Const (constant) when defining variables worked as expected.

See following code for reference

 

Const DataTableName = "TEST"
Public BatteryV

DataTable (DataTableName, 1, -1)
	DataInterval (0, 15, Sec, 10)
        Sample (1, BatteryV, FP2, 0)
EndTable

BeginProg
	Scan (1,Sec,0,0)
	  Battery(BatteryV)
		CallTable DataTableName
	NextScan
EndProg

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