User Tools

Site Tools


faq23

SCADA software LAquis FAQ | SCADA software

Question: How to access specific database field?

Answer:

There are several ways.

Specific fields can be accessed by script or formula.

In reports formula: =FIELD(“field name”;“filter”;date;“database”;maximum;dateto;id field;“sampling”)

Example: =FIELD(“Tag3”;“1”;0;“TEST1.LB”;0;0;“Tag1”;“”)

Script examples:

Example 1:

LB.GetDatabaseField(response_field,database_name,field,value)

....
s = ""
s = LB.GetDatabaseField("Tag3","TEST.LB","Tag1","1") ' Get Tag3 when Tag1 = 1

Example 2:

s = ""
LB.Date = date ' current date
LB.Open("TEST.LB") ' open database test.lb
LB.Filter("Tag1 = 1") ' filter Tag1 = 1. To get all registers do LB.Filter("")
n = LB.RecordCount ' n = number of records filtered in database
if n > 0 then
 for i = 0 to n - 1
  LB.Pos = i ' point to register i
  LB.Read ' read this register
  s = LB.Fields("Tag3")   ' get Tag3 as string
  x = LB.FieldsN("Tag3")  ' get Tag3 as number
 next
end if
LB.Close

SCADA software

faq23.txt · Last modified: 2016/08/31 18:10 by scadalaquis

Page Tools


Tags: SCADA software , SCADA systems.