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.

FieldNames and Bool8


Carli Jun 27, 2017 09:30 AM

Hey,

i am using the boolean values to save statusse memory efficient.

So lets say I am saving error codes in a long where 0 is no error. 1 a general error, 2 malfunction one and 4  malfunction two, 8 sensor out of range error, 16 sensor constant error and so one.

Saving this to a long variable with OR works quite well.  The only problem left is that I have to remember which bit has what which meaning.

I thought I can use FieldNames for this but it will not allow to rename the different bits, just the bytes:

Minimal example: 

Public Bla(2) As Long

DataTable (Test,1,-1) 
	Sample (2,Bla,BOOL8)
	FieldNames("1-General:,1-Malfunction1:,1-Malfunction2,1-SensorOutOfRange:,1-SensorConstantError:ES,1-32:ED,1-64:EVS,1-128:EZA,2-1:,2-2:,2-4:,2-8:,2-16:,2-32:,2-64:,2-128:")
EndTable

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

 

This results in the Fields

1-Gerneral(1)

1-General(2)

...

1-General(8)

1-Malfunction1(1)

1-Malfunction1(2)

...

1-Malfunction1(8)

Expected Result

1-General

1-Malfunction1

1-Malfunction2

1-SensorOutOfRange

...

Is there any way that I can achive this behavior?

Already tried to define  

FieldNames("1-General(1),1-Malfunction1(1),1-Malfunction2(1)...

 but this did not work either, resulting in the same fields like above.

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