esi-labxbridge
A library for communicating with the LabXBridge.
Requirements
A working Installation of LabX Bridge is required.
Dependencies
| library | version | inmation core library |
|---|---|---|
dkjson |
2.5.0 |
yes |
socket |
3.0.0 |
yes |
esi-variables |
1.0.0 |
yes |
esi-tool |
1.0.5 |
yes |
Available functions
All functions have to be called according to the ESI standard, using colons, e.g. lib:FUNCTIONNAME(params)
Documentation
CHANGERPOSITIONORIGINS
CHANGERPOSITIONORIGINS returns the list with all values of ChangerPositionOrigin enumeration.
DATETIMEINPUTKINDS
DATETIMEINPUTKINDS returns the list with all values of DateTimeInputKind enumeration.
INSTRUMENTSUMMARYCONNECTIONSTATES
INSTRUMENTSUMMARYCONNECTIONSTATES returns the list with all values of InstrumentSummaryConnectionState enumeration.
SETCONNECTION
SETCONNECTION configures TCP connection settings.
It should be called before any other LabX Bridge function.
TESTCONNECTION
TESTCONNECTION tests connection with LabX Bridge Server.
CLOSECONNECTION
CLOSECONNECTION closes existing TCP connection.
GETSTATUS
GETSTATUS returns information about LabX Bridge service.
Returns
-
status["Version"] - the version of the LabX Bridge Service.
-
status[".NET Version"] - the .NET version of the LabX Bridge Service.
-
status["BufferSize"] - the buffer size used to send data to the client.
-
status["TCPPortClient"] - the TCP port used by clients.
-
status["MaxTCPConnectionQueues"] - the maximum length of the pending TCP connections queue.
-
status["TCPEndOfTransmissionSignal"] - the client and the server are sending this string at the end of the command.
-
status["ServiceName"] - the name of the LabX Bridge service.
-
status["ServiceDisplayName"] - the display name of the LabX Bridge service.
-
status["EndpointAddress"] - the address of the LabX Bussines Server endpoint.
-
status["ClientBaseAddress"] - the IP address of client PC where your client app is running, also called Callback point.
-
status["SecurityMode"] - the security mode for wsDualHttpBinding (the used WCF protocol between LabX Bridge and LabX Server).
-
status["KeepAliveIntervalSeconds"] - a periodical method call is executed to keep the LabX Server session open. KeepAliveIntervalSeconds parameter defines this period in seconds.
-
status["SubscriptionMaxItemsCount"] - the maximum number of notifications being buffered.
-
status["SubscriptionMaxReturnedItemsCount"] - the maximum number of notifications retrieved with one GETNOTIFICATIONS() Lua call.
-
status["SubscriptionMaxGetEventsIntervalSeconds"] - the maximum time in seconds that the notifications buffer will be held in memory without the Connector retrieving data.
GETALLRELEASEDMETHODS
GETALLRELEASEDMETHODS returns all released method versions currently available in the LabX database. Methods which are not valid are not returned.
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.MaxNumberOfRecords = 1000
local result, exception = lib:GETALLRELEASEDMETHODS(args)
if exception then
return (require "esi-string"):STRING({ex=exception})
else
if result.MoreItems then
local cargs = {}
cargs.ContinuationKey = result.ContinuationKey
while true do
local lresult, exception = lib:GETCONTINUATION(cargs)
if exception then
return (require "esi-string"):STRING({ex=exception})
end
for ii=1,#lresult.farg do
result.farg[#result.farg+1] = lresult.farg[ii]
end
if not lresult.MoreItems then
break
end
end
end
end
return (require "esi-string"):STRING({res=result,ex=exception})
Return Values
{"res": {
"func": "GetAllReleasedMethods",
"farg": [
{
"MethodId": "Weighing (Result)",
"Name": "Simple Weighing (with Result)",
"InternalId": "M12",
"ReleaseState": "Released",
"BusinessId": "2e71a556-957d-4ef2-99a2-a0f254c5aaa7",
"Comment": ""
},
{
"MethodId": "Sample scope only",
"Name": "Sample scope only",
"InternalId": "M13",
"ReleaseState": "Released",
"BusinessId": "3dae4bfa-814e-4101-88e3-f38d7c821b6c",
"Comment": ""
}
],
"MoreItems": false
}
}
GETTHISMETHOD
GETTHISMETHOD returns the basic method information of a method (specified by its GUID).
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.BusinessId = "2e71a556-957d-4ef2-99a2-a0f254c5aaa7"
local result, exception = lib:GETTHISMETHOD(args)
return (require "esi-string"):STRING({res=result,ex=exception})
Return Values
{ "res": {
"farg": {
"BusinessId": "2e71a556-957d-4ef2-99a2-a0f254c5aaa7",
"MethodId": "Weighing (Result)",
"InternalId": "M12",
"Comment": "",
"ReleaseState": "Released",
"Name": "Simple Weighing (with Result)"
},
"func": "GetThisMethod"
}
}
or, if the the method does not exist
{
"res": {
"farg": {},
"func": "GetThisMethod"
}
}
GETTHISMETHODBYUSERDEFINEDID
GETTHISMETHODBYUSERDEFINEDID returns the basic method information from a method with its user defined method ID (=ID in the method properties in the LabX method editor).
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.UserDefinedMethodId = "Weighing (Result)"
local result, exception = lib:GETTHISMETHODBYUSERDEFINEDID(args)
return (require "esi-string"):STRING({res=result,ex=exception})
Return Values
{"res": {
"farg": {
"BusinessId": "2e71a556-957d-4ef2-99a2-a0f254c5aaa7",
"Comment": "",
"MethodId": "Weighing (Result)",
"Name": "Simple Weighing (with Result)",
"InternalId": "M12",
"ReleaseState": "Released"
},
"func": "GetThisMethodByUserDefinedId"
}
}
or, if the method does not exist
{"res": {
"farg":{},
"func":"GetThisMethodByUserDefinedId"
}
}
GETMETHODMETADATA
GETMETHODMETADATA returns the meta data of the method.
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.BusinessId = "2e71a556-957d-4ef2-99a2-a0f254c5aaa7"
local result, exception = lib:GETMETHODMETADATA(args)
return (require "esi-string"):STRING({res=result,ex=exception})
Return Values
{"res": {
"farg": {
"Scopes": [
{
"SampleChangerPosition": {
"Position": 0,
"ChangerPositionOrigin": "Relative"
},
"MethodParameters": [],
"ScopeName": "Samplescope1",
"SampleId": {
"SampleId4": {
"Label": "Sample ID 4",
"IsMandatory": false,
"DefaultValue": ""
},
"SampleId1": {
"Label": "Sample ID",
"IsMandatory": true,
"DefaultValue": ""
},
"SampleId3": {
"Label": "Sample ID 3",
"IsMandatory": false,
"DefaultValue": ""
},
"SampleId6": {
"Label": "Sample ID 6",
"IsMandatory": false,
"DefaultValue": ""
},
"SampleId5": {
"Label": "Sample ID 5",
"IsMandatory": false,
"DefaultValue": ""
},
"SampleId2": {
"Label": "Sample ID 2",
"IsMandatory": false,
"DefaultValue": ""
}
}
}
],
"MethodParameters": [
{
"MinValue": 0.0,
"MethodFunctionPropertyName": "start",
"MaxValue": 1.0,
"MethodFunctionName": "Calculate",
"DecimalPlaces": 0,
"$type": "inmationLabXBridge.LabX.DecimalTypeMetaData, LabXBridge"
},
{
"$type": "inmationLabXBridge.LabX.IntegerTypeMetaData, LabXBridge",
"MethodFunctionPropertyName": "value",
"MaxValue": 10,
"MethodFunctionName": "SetValue",
"MinValue": -10
},
{
"$type": "inmationLabXBridge.LabX.BoolTypeMetaData, LabXBridge",
"MethodFunctionName": "SetVisibility",
"MethodFunctionPropertyName": "visible"
},
{
"$type": "inmationLabXBridge.LabX.DateTimeTypeMetaData, LabXBridge",
"InputKind": "DateTime",
"MethodFunctionName": "SetStart",
"MethodFunctionPropertyName": "starttime"
},
{
"$type": "inmationLabXBridge.LabX.StringTypeMetaData, LabXBridge",
"MethodFunctionName": "SetText",
"MethodFunctionPropertyName": "text1"
},
{
"$type": "inmationLabXBridge.LabX.StringTypeMetaData, LabXBridge",
"MethodFunctionName": "SetText",
"MethodFunctionPropertyName": "text2"
},
{
"SelectableItems": [
"A",
"B",
"C"
],
"MethodFunctionName": "SetType",
"$type": "inmationLabXBridge.LabX.EnumerationTypeMetaData, LabXBridge",
"MethodFunctionPropertyName": "type"
}
]
},
"func": "GetMethodMetaData"
}
}
GETALLAVAILABLEINSTRUMENTS
GETALLAVAILABLEINSTRUMENTS returns all available (defined in LabX) instruments.
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.MaxNumberOfRecords = 100
local result, exception = lib:GETALLAVAILABLEINSTRUMENTS(args)
if exception then
return (require "esi-string"):STRING({ex=exception})
else
if result.MoreItems then
local cargs = {}
cargs.ContinuationKey = result.ContinuationKey
while true do
local lresult, exception = lib:GETCONTINUATION(cargs)
if exception then
return (require "esi-string"):STRING({ex=exception})
end
for ii=1,#lresult.farg do
result.farg[#result.farg+1] = lresult.farg[ii]
end
if not lresult.MoreItems then
break
end
end
end
end
return (require "esi-string"):STRING({res=result,ex=exception})
Return Values
{"res": {
"func": "GetAllAvailableInstruments",
"farg": [
{
"MethodId": "Weighing (Result)",
"Name": "Simple Weighing (with Result)",
"InternalId": "M12",
"ReleaseState": "Released",
"BusinessId": "2e71a556-957d-4ef2-99a2-a0f254c5aaa7",
"Comment": ""
},
{
"MethodId": "Sample scope only",
"Name": "Sample scope only",
"InternalId": "M13",
"ReleaseState": "Released",
"BusinessId": "3dae4bfa-814e-4101-88e3-f38d7c821b6c",
"Comment": ""
}
],
"MoreItems": false
}
}
GETTHISINSTRUMENTSBYNAME
GETTHISINSTRUMENTSBYNAME returns the list of instruments for which the name matches with provided parameter.
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.InstrumentName = "XPE205 Simulator"
local result, exception = lib:GETTHISINSTRUMENTSBYNAME(args)
return (require "esi-string"):STRING({res=result,ex=exception})
Return Values
{ "res": {
"farg": [
{
"AvailabilityStatus": "Disconnected",
"SerialNumber": "1111122222/1111122222",
"ExtendedProperties": {},
"Product": "BalanceExcellence",
"InstrumentId": "1d8ac640-e155-44f6-8341-8090068ceae5",
"InstrumentModel": "XPE205",
"AvailableWorkspaces": [
"Default"
],
"InternalId": "I6",
"ProductFamily": "BalanceExcellence",
"IsDeleted": false,
"InstrumentName": "XPE205 Simulator"
}
],
"func": "GetThisInstrumentsByName",
"MoreItems": false
}
}
GETTHISINSTRUMENTBYID
GETTHISINSTRUMENTBYID returns the properties of the instrument specified by its GUID.
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.InstrumentId = "1d8ac640-e155-44f6-8341-8090068ceae5"
local result, exception = lib:GETTHISINSTRUMENTBYID(args)
return (require "esi-string"):STRING({res=result,ex=exception})
Return Values
{ "res": {
"farg": {
"ExtendedProperties": {},
"SerialNumber": "1111122222/1111122222",
"InternalId": "I6",
"AvailabilityStatus": "Disconnected",
"IsDeleted": false,
"ProductFamily": "BalanceExcellence",
"Product": "BalanceExcellence",
"InstrumentId": "1d8ac640-e155-44f6-8341-8090068ceae5",
"AvailableWorkspaces": [
"Default"
],
"InstrumentName": "XPE205 Simulator",
"InstrumentModel": "XPE205"
},
"func": "GetThisInstrumentById"
}
}
or, if the instrument does not exist
{
"res": {
"func": "GetThisInstrumentById",
"farg": {}
}
}
GETALLRELEASEDPRODUCTS
GETALLRELEASEDPRODUCTS returns all released products in LabX.
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.MaxNumberOfRecords = 1000
local result, exception = lib:GETALLRELEASEDPRODUCTS(args)
if exception then
return (require "esi-string"):STRING({ex=exception})
else
if result.MoreItems then
local cargs = {}
cargs.ContinuationKey = result.ContinuationKey
while true do
local lresult, exception = lib:GETCONTINUATION(cargs)
if exception then
return (require "esi-string"):STRING({ex=exception})
end
for ii=1,#lresult.farg do
result.farg[#result.farg+1] = lresult.farg[ii]
end
if not lresult.MoreItems then
break
end
end
end
end
return (require "esi-string"):STRING({res=result,ex=exception})
Return Values
{"res": {
"farg": [
{
"Comment": "",
"Name": "Test Product 1",
"InternalId": "P11",
"BusinessId": "e28c47e7-6060-4f49-8b47-475ba816388f",
"ProductId": "Test Product 1",
"Description": ""
},
{
"Comment": "",
"Name": "Test Product 2",
"InternalId": "P22",
"BusinessId": "48a340f5-b068-4dbc-a4d6-34cc77dbfc74",
"ProductId": "Test Product 2",
"Description": ""
}
],
"MoreItems": false,
"func": "GetAllReleasedProducts"
}
}
GETTHISPRODUCT
GETTHISPRODUCT returns detail information of the selected product.
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.BusinessId = "f33fd37c-f37d-4dbe-b62d-90c8839b203d"
local result, exception = lib:GETTHISPRODUCT(args)
return (require "esi-string"):STRING({res=result,ex=exception})
Return Values
{"res": {
"func": "GetThisProduct",
"farg": {
"MethodAssignments": [
{
"MethodBusinessId": "2e71a556-957d-4ef2-99a2-a0f254c5aaa7",
"MethodParameters": []
}
],
"ProductHeader": {
"Description": "",
"ProductId": "Test Product",
"InternalId": "P11",
"Name": "Test Product",
"BusinessId": "e28c47e7-6060-4f49-8b47-475ba816388f",
"Comment": ""
}
}
}
}
Exceptions
{"ex": [{"Exception":false,"msg":"'f33fd37c-f37d-4dbe-b62d-90c8839b203dx' is not valid guid"}]}
or
{"ex": {"tcp":"timeout","msg":"Error during TCP connection"}}
or
{"ex": [{"Exception":true,"msg":"ProductNotExistFault: Product with id e28c47e7-6060-4f49-8b47-475ba816389f does not exist"}]}
or
"connection refused"
GETALLSAMPLESERIES
GETALLSAMPLESERIES returns all sample series defined in LabX.
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.MaxNumberOfRecords = 10
local result, exception = lib:GETALLSAMPLESERIES(args)
if exception then
return (require "esi-string"):STRING({ex=exception})
else
if result.MoreItems then
local cargs = {}
cargs.ContinuationKey = result.ContinuationKey
while true do
local lresult, exception = lib:GETCONTINUATION(cargs)
if exception then
return (require "esi-string"):STRING({ex=exception})
end
for ii=1,#lresult.farg do
result.farg[#result.farg+1] = lresult.farg[ii]
end
if not lresult.MoreItems then
break
end
end
end
end
return (require "esi-string"):STRING({res=result,ex=exception})
Return Values
{"res": {
"MoreItems": false,
"ContinuationKey": "a50df2a7-8acc-49c9-b1cc-70d772a311d2",
"farg": [
{
"Comment": "",
"BusinessId": "5cb15cd9-4078-4c9b-9601-6bfbe73cf14e",
"Name": "NewSampleSeries1",
"MethodBusinessId": "3dae4bfa-814e-4101-88e3-f38d7c821b6c",
"SeriesId": "",
"InternalId": "SR11"
},
{
"Comment": "",
"BusinessId": "91697711-ee13-40cf-b3db-46130f12768b",
"Name": "NewSampleSeries2",
"MethodBusinessId": "3dae4bfa-814e-4101-88e3-f38d7c821b6c",
"SeriesId": "",
"InternalId": "SR12"
}
],
"func": "GetAllSampleSeries"
}
}
GETTHISSAMPLESERIES
GETTHISSAMPLESERIES returns detail information of the selected sample series.
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.BusinessId = "f33fd37c-f37d-4dbe-b62d-90c8839b203d"
local result, exception = lib:GETTHISSAMPLESERIES(args)
return (require "esi-string"):STRING({res=result,ex=exception})
Return Values
{"res: "{
"func": "GetThisSampleSeries",
"farg": {
"PredefinedSamples": [
{
"SampleId": {
"SampleId1": "Sample 1",
"SampleId3": "",
"SampleId6": "",
"SampleId4": "",
"SampleId2": "",
"SampleId5": ""
},
"MethodParameters": [],
"SampleScopeName": "Samplescope1",
"ProductId": "e28c47e7-6060-4f49-8b47-475ba816388f",
"SampleChangerPosition": {
"ChangerPositionOrigin": "Relative",
"Position": 0
}
},
{
"SampleId": {
"SampleId1": "Sample 2",
"SampleId3": "",
"SampleId6": "",
"SampleId4": "",
"SampleId2": "",
"SampleId5": ""
},
"MethodParameters": [],
"SampleScopeName": "Samplescope1",
"ProductId": "e28c47e7-6060-4f49-8b47-475ba816388f",
"SampleChangerPosition": {
"ChangerPositionOrigin": "Relative",
"Position": 0
}
},
{
"SampleId": {
"SampleId1": "Sample 3",
"SampleId3": "",
"SampleId6": "",
"SampleId4": "",
"SampleId2": "",
"SampleId5": ""
},
"MethodParameters": [],
"SampleScopeName": "Samplescope1",
"ProductId": "e28c47e7-6060-4f49-8b47-475ba816388f",
"SampleChangerPosition": {
"ChangerPositionOrigin": "Relative",
"Position": 0
}
},
{
"SampleId": {
"SampleId1": "Sample 4",
"SampleId3": "",
"SampleId6": "",
"SampleId4": "",
"SampleId2": "",
"SampleId5": ""
},
"MethodParameters": [],
"SampleScopeName": "Samplescope1",
"ProductId": "e28c47e7-6060-4f49-8b47-475ba816388f",
"SampleChangerPosition": {
"ChangerPositionOrigin": "Relative",
"Position": 0
}
},
{
"SampleId": {
"SampleId1": "sample 5",
"SampleId3": "",
"SampleId6": "",
"SampleId4": "",
"SampleId2": "",
"SampleId5": ""
},
"MethodParameters": [],
"SampleScopeName": "Samplescope1",
"ProductId": "e28c47e7-6060-4f49-8b47-475ba816388f",
"SampleChangerPosition": {
"ChangerPositionOrigin": "Relative",
"Position": 0
}
}
],
"SampleSeriesHeader": {
"InternalId": "SR11",
"Name": "NewSampleSeries1",
"BusinessId": "5cb15cd9-4078-4c9b-9601-6bfbe73cf14e",
"Comment": "",
"MethodBusinessId": "3dae4bfa-814e-4101-88e3-f38d7c821b6c",
"SeriesId": ""
},
"MethodParameters": []
}
}
}
Exceptions
{"ex": [{"Exception":false,"msg":"'e28c47e7-6060-4f49-8b47-475ba816388fnnn' is not valid guid"}]}
or
{"ex": {"tcp":"timeout","msg":"Error during TCP connection"}}
or
{"ex":[{"msg":"SampleSerieNotExistFault: Sample series with id 5cb15cd9-4078-4c9b-9601-6bfbe73cf142 does not exist","Exception":false}]}
or
"connection refused"
GETALLEXECUTABLETASKS
GETALLEXECUTABLETASKS returns all tasks with status other than "Completed", "Aborted" or "Running".
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.MaxNumberOfRecords = 10
local result, exception = lib:GETALLEXECUTABLETASKS(args)
if exception then
return (require "esi-string"):STRING({ex=exception})
else
if result.MoreItems then
local cargs = {}
cargs.ContinuationKey = result.ContinuationKey
while true do
local lresult, exception = lib:GETCONTINUATION(cargs)
if exception then
return (require "esi-string"):STRING({ex=exception})
end
for ii=1,#lresult.farg do
result.farg[#result.farg+1] = lresult.farg[ii]
end
if not lresult.MoreItems then
break
end
end
end
end
return (require "esi-string"):STRING({res=result,ex=exception})
Return Values
{"res": {
"farg": [
{
"TaskId": "eaaf5ad1-dc97-40fc-bbb6-3538e6713538",
"MethodBusinessId": "3dae4bfa-814e-4101-88e3-f38d7c821b6c",
"TaskState": "Paused",
"CreationTime": "2024-02-13T03:17:43.87",
"AccountName": "PredefinedUser",
"InternalId": "T12",
"Name": "Sample scope only",
"MethodName": "Sample scope only"
},
{
"TaskId": "01456f1f-ea45-4630-9af5-94709ef9c1f9",
"MethodBusinessId": "3dae4bfa-814e-4101-88e3-f38d7c821b6c",
"TaskState": "Created",
"CreationTime": "2024-02-13T04:01:52.4",
"AccountName": "PredefinedUser",
"InternalId": "T15",
"Name": "Sample scope only",
"MethodName": "Sample scope only"
},
{
"TaskId": "f33fd37c-f37d-4dbe-b62d-90c8839b203d",
"MethodBusinessId": "3dae4bfa-814e-4101-88e3-f38d7c821b6c",
"TaskState": "Paused",
"CreationTime": "2024-02-13T04:29:28.89",
"AccountName": "PredefinedUser",
"InternalId": "T16",
"Name": "Sample scope only",
"MethodName": "Sample scope only"
}
],
"MoreItems": true,
"ContinuationKey": "69bafc54-86b9-4ec3-98ac-ab07b47d737f",
"func": "GetAllExecutableTasks"
}
}
GETALLTASKSINRANGE
GETALLTASKSINRANGE returns the list with all tasks in LabX that were created in the range of the specified FromDate and ToDate. However the date range must not exceed 3 days per call.
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.FromDate = "2024-02-13T09:59:59"
args.ToDate = "2024-02-14T23:59:59"
args.MaxNumberOfRecords = 2
local result, exception = lib:GETALLTASKSINRANGE(args)
if exception then
return (require "esi-string"):STRING({ex=exception})
else
if result.MoreItems then
local cargs = {}
cargs.ContinuationKey = result.ContinuationKey
while true do
local lresult, exception = lib:GETCONTINUATION(cargs)
if exception then
return (require "esi-string"):STRING({ex=exception})
end
for ii=1,#lresult.farg do
result.farg[#result.farg+1] = lresult.farg[ii]
end
if not lresult.MoreItems then
break
end
end
end
end
return (require "esi-string"):STRING({res=result,ex=exception})
Return Values
{ "res": {
"MoreItems": true,
"ContinuationKey": "029f6d1d-d766-4b0c-9aec-cd11ad20e615",
"func": "GetAllTasksInRange",
"farg": [
{
"MethodBusinessId": "3dae4bfa-814e-4101-88e3-f38d7c821b6c",
"TaskState": "Paused",
"TaskId": "f33fd37c-f37d-4dbe-b62d-90c8839b203d",
"MethodName": "Sample scope only",
"InternalId": "T16",
"AccountName": "PredefinedUser",
"Name": "Sample scope only",
"CreationTime": "2024-02-13T04:29:28.89"
},
{
"MethodBusinessId": "3dae4bfa-814e-4101-88e3-f38d7c821b6c",
"TaskState": "Created",
"TaskId": "01456f1f-ea45-4630-9af5-94709ef9c1f9",
"MethodName": "Sample scope only",
"InternalId": "T15",
"AccountName": "PredefinedUser",
"Name": "Sample scope only",
"CreationTime": "2024-02-13T04:01:52.4"
},
{
"MethodBusinessId": "2e71a556-957d-4ef2-99a2-a0f254c5aaa7",
"TaskState": "Completed",
"TaskId": "9d2443fb-78ee-4276-994c-c1598c1ab6b0",
"MethodName": "Simple Weighing (with Result)",
"InternalId": "T14",
"AccountName": "PredefinedUser",
"Name": "T14_Simple Weighing (with Result)",
"CreationTime": "2024-02-13T03:50:54.61"
},
{
"MethodBusinessId": "3dae4bfa-814e-4101-88e3-f38d7c821b6c",
"TaskState": "Paused",
"TaskId": "eaaf5ad1-dc97-40fc-bbb6-3538e6713538",
"MethodName": "Sample scope only",
"InternalId": "T12",
"AccountName": "PredefinedUser",
"Name": "Sample scope only",
"CreationTime": "2024-02-13T03:17:43.87"
}
]
}
}
GETTHISTASK
GETTHISTASK returns the properties of the selected task (specified by its GUID).
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.TaskId = "f33fd37c-f37d-4dbe-b62d-90c8839b203d"
local result, exception = lib:GETTHISTASK(args)
return (require "esi-string"):STRING({res=result,ex=exception})
Return Values
{"res": {
"farg":
{
"TaskState":"Paused",
"AccountName":"PredefinedUser",
"TaskId":"f33fd37c-f37d-4dbe-b62d-90c8839b203d",
"MethodBusinessId":"3dae4bfa-814e-4101-88e3-f38d7c821b6c",
"CreationTime":"2024-02-13T04:29:28.89",
"Name":"Sample scope only",
"MethodName":"Sample scope only",
"InternalId":"T16"
},
"func":"GetThisTask"
}
}
or, if the task does not exist
{"res": {
"farg":{},
"func":"GetThisTask"
}
}
CREATEPRODUCT
CREATEPRODUCT creates a product.
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.Name = ""
args.ProductId = "Test product 1"
args.Comment = "This is test product"
args.Description = ""
args.MethodAssignments = {}
args.MethodAssignments[1] = {}
args.MethodAssignments[1].MethodBusinessId = "2e71a556-957d-4ef2-99a2-a0f254c5aaa7"
args.MethodAssignments[1].MethodParameters = {}
args.MethodAssignments[1].MethodParameters[1] = {}
args.MethodAssignments[1].MethodParameters[1].MethodFunctionPropertyType = "Decimal"
args.MethodAssignments[1].MethodParameters[1].MethodFunctionPropertyValue = "10.5"
args.MethodAssignments[1].MethodParameters[1].MethodFunctionName = "Calculate"
args.MethodAssignments[1].MethodParameters[1].MethodFunctionPropertyName = "value"
args.MethodAssignments[1].MethodParameters[2] = {}
args.MethodAssignments[1].MethodParameters[2].MethodFunctionPropertyType = "Bool"
args.MethodAssignments[1].MethodParameters[2].MethodFunctionPropertyValue = true
args.MethodAssignments[1].MethodParameters[2].MethodFunctionName = "SetVisibility"
args.MethodAssignments[1].MethodParameters[2].MethodFunctionPropertyName = "visible"
args.MethodAssignments[1].MethodParameters[3] = {}
args.MethodAssignments[1].MethodParameters[3].MethodFunctionPropertyType = "DateTime"
args.MethodAssignments[1].MethodParameters[3].MethodFunctionPropertyValue = "2024-03-22T14:10:00"
args.MethodAssignments[1].MethodParameters[3].MethodFunctionName = "SetStart"
args.MethodAssignments[1].MethodParameters[3].MethodFunctionPropertyName = "startTime"
args.MethodAssignments[1].MethodParameters[4] = {}
args.MethodAssignments[1].MethodParameters[4].MethodFunctionPropertyType = "Enumeration"
args.MethodAssignments[1].MethodParameters[4].MethodFunctionPropertyValue = "A"
args.MethodAssignments[1].MethodParameters[4].MethodFunctionName = "SetType"
args.MethodAssignments[1].MethodParameters[4].MethodFunctionPropertyName = "type"
args.MethodAssignments[1].MethodParameters[5] = {}
args.MethodAssignments[1].MethodParameters[5].MethodFunctionPropertyType = "Integer"
args.MethodAssignments[1].MethodParameters[5].MethodFunctionPropertyValue = "15"
args.MethodAssignments[1].MethodParameters[5].MethodFunctionName = "SetValue"
args.MethodAssignments[1].MethodParameters[5].MethodFunctionPropertyName = "value"
args.MethodAssignments[1].MethodParameters[6] = {}
args.MethodAssignments[1].MethodParameters[6].MethodFunctionPropertyType = "String"
args.MethodAssignments[1].MethodParameters[6].MethodFunctionPropertyValue = "Test1"
args.MethodAssignments[1].MethodParameters[6].MethodFunctionName = "SetText"
args.MethodAssignments[1].MethodParameters[6].MethodFunctionPropertyName = "text1"
args.MethodAssignments[1].MethodParameters[7] = {}
args.MethodAssignments[1].MethodParameters[7].MethodFunctionPropertyType = "String"
args.MethodAssignments[1].MethodParameters[7].MethodFunctionPropertyValue = "Test2"
args.MethodAssignments[1].MethodParameters[7].MethodFunctionName = "SetText"
args.MethodAssignments[1].MethodParameters[7].MethodFunctionPropertyName = "text2"
args.MethodAssignments[2] = {}
args.MethodAssignments[2].MethodBusinessId = "6254e992-daef-4425-ab7c-3893ab14f168"
args.MethodAssignments[2].MethodParameters = {}
args.MethodAssignments[2].MethodParameters[1] = {}
args.MethodAssignments[2].MethodParameters[1].MethodFunctionPropertyType = "Decimal"
args.MethodAssignments[2].MethodParameters[1].MethodFunctionPropertyValue = "33.5"
args.MethodAssignments[2].MethodParameters[1].MethodFunctionName = "CalculateTotal"
args.MethodAssignments[2].MethodParameters[1].MethodFunctionPropertyName = "value"
local result, exception = lib:CREATEPRODUCT(args)
return (require "esi-string"):STRING({res=result,ex=exception})
Return Values
{
"res": {
"func": "CreateProduct",
"farg": {
"ProductHeader": {
"Comment": "mycomment",
"Description": "mydescription",
"Name": "This is product name",
"BusinessId": "0c6bfc2c-72f8-4aee-ab53-23e3a52791f8",
"InternalId": "P80",
"ProductId": "myProductId1"
},
"MethodAssignments": [
{
"MethodParameters": [
{
"MethodFunctionPropertyName": "value",
"Value": 10.5,
"$type": "LabXBridge.LabX.DecimalTypeMethodParameter, LabXBridge",
"MethodFunctionName": "Calculate"
},
{
"MethodFunctionPropertyName": "visible",
"Value": true,
"$type": "LabXBridge.LabX.BoolTypeMethodParameter, LabXBridge",
"MethodFunctionName": "SetVisibility"
},
{
"MethodFunctionPropertyName": "startTime",
"Value": "2024-03-22T14:10:00",
"$type": "LabXBridge.LabX.DateTimeTypeMethodParameter, LabXBridge",
"MethodFunctionName": "SetStart"
},
{
"MethodFunctionPropertyName": "type",
"Value": "A",
"$type": "LabXBridge.LabX.EnumerationTypeMethodParameter, LabXBridge",
"MethodFunctionName": "SetType"
},
{
"MethodFunctionPropertyName": "value",
"Value": 15,
"$type": "LabXBridge.LabX.IntegerTypeMethodParameter, LabXBridge",
"MethodFunctionName": "SetValue"
},
{
"MethodFunctionPropertyName": "text1",
"Value": "Test1",
"$type": "LabXBridge.LabX.StringTypeMethodParameter, LabXBridge",
"MethodFunctionName": "SetText"
},
{
"MethodFunctionPropertyName": "text2",
"Value": "Test2",
"$type": "LabXBridge.LabX.StringTypeMethodParameter, LabXBridge",
"MethodFunctionName": "SetText"
}
],
"MethodBusinessId": "2e71a556-957d-4ef2-99a2-a0f254c5aaa7"
},
{
"MethodParameters": [
{
"MethodFunctionPropertyName": "value",
"Value": 33.5,
"$type": "LabXBridge.LabX.DecimalTypeMethodParameter, LabXBridge",
"MethodFunctionName": "CalculateTotal"
}
],
"MethodBusinessId": "6254e992-daef-4425-ab7c-3893ab14f168"
}
]
}
}
}
REMOVEPRODUCT
REMOVEPRODUCT removes a product in LabX.
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.BusinessId = "609cee6d-e8a5-4d71-8ec7-ec73cf2948ee"
local result, exception = lib:REMOVEPRODUCT(args)
return (require "esi-string"):STRING({res=result,ex=exception})
Exceptions
{"ex": [{"Exception":false,"msg":"'x33fd37c-f37d-4dbe-b62d-90c8839b203d' is not valid guid"}]}
or
{"ex":[{"Exception":true,"msg":"ProductNotExistFault: Product with id 9d2443fb-78ee-4276-994c-c1598c1ab6b1 does not exist"}]}
or
{"ex": {"tcp":"timeout","msg":"Error during TCP connection"}}
or
"connection refused"
CREATESAMPLESERIES
CREATESAMPLESERIES creates a sample series.
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.Name = "Test sample series 1"
args.SeriesId = "myseriesid1"
args.Comment = "This is test sample series"
args.MethodBusinessId = "2e71a556-957d-4ef2-99a2-a0f254c5aaa7"
args.PredefinedSamples = {}
args.PredefinedSamples[2] = {}
args.PredefinedSamples[2].MethodParameters = {}
args.PredefinedSamples[2].MethodParameters[1] = {}
args.PredefinedSamples[2].MethodParameters[1].MethodFunctionPropertyType = "Decimal"
args.PredefinedSamples[2].MethodParameters[1].MethodFunctionPropertyValue = "12.5"
args.PredefinedSamples[2].MethodParameters[1].MethodFunctionName = "CalculateWeight"
args.PredefinedSamples[2].MethodParameters[1].MethodFunctionPropertyName = "value"
args.PredefinedSamples[2].MethodParameters[2] = {}
args.PredefinedSamples[2].MethodParameters[2].MethodFunctionPropertyType = "String"
args.PredefinedSamples[2].MethodParameters[2].MethodFunctionPropertyValue = "Weigh a sample"
args.PredefinedSamples[2].MethodParameters[2].MethodFunctionName = "Weight1"
args.PredefinedSamples[2].MethodParameters[2].MethodFunctionPropertyName = "instruction"
args.PredefinedSamples[2].SampleId = {}
args.PredefinedSamples[2].SampleId.SampleId1 = "B"
args.PredefinedSamples[2].SampleId.SampleId2 = ""
args.PredefinedSamples[2].SampleId.SampleId3 = ""
args.PredefinedSamples[2].SampleId.SampleId4 = ""
args.PredefinedSamples[2].SampleId.SampleId5 = ""
args.PredefinedSamples[2].SampleId.SampleId6 = ""
args.PredefinedSamples[2].SampleScopeName = "Samplescope1"
args.PredefinedSamples[2].ProductId = "e28c47e7-6060-4f49-8b47-475ba816388f"
args.PredefinedSamples[2].SampleChangerPosition = {}
-- this value may be "Undefined", "Absolute", "Relative", "DetectSample"
args.PredefinedSamples[2].SampleChangerPosition.ChangerPositionOrigin = "Absolute"
args.PredefinedSamples[2].SampleChangerPosition.Position = 3
args.PredefinedSamples[1] = {}
args.PredefinedSamples[1].MethodParameters = {}
args.PredefinedSamples[1].MethodParameters[1] = {}
args.PredefinedSamples[1].MethodParameters[1].MethodFunctionPropertyType = "Decimal"
args.PredefinedSamples[1].MethodParameters[1].MethodFunctionPropertyValue = "1.5"
args.PredefinedSamples[1].MethodParameters[1].MethodFunctionName = "CalculateWeight"
args.PredefinedSamples[1].MethodParameters[1].MethodFunctionPropertyName = "value"
args.PredefinedSamples[1].MethodParameters[2] = {}
args.PredefinedSamples[1].MethodParameters[2].MethodFunctionPropertyType = "String"
args.PredefinedSamples[1].MethodParameters[2].MethodFunctionPropertyValue = "Weigh a next sample"
args.PredefinedSamples[1].MethodParameters[2].MethodFunctionName = "Weight1"
args.PredefinedSamples[1].MethodParameters[2].MethodFunctionPropertyName = "instruction"
args.PredefinedSamples[1].SampleId = {}
args.PredefinedSamples[1].SampleId.SampleId1 = "A"
args.PredefinedSamples[1].SampleId.SampleId2 = ""
args.PredefinedSamples[1].SampleId.SampleId3 = ""
args.PredefinedSamples[1].SampleId.SampleId4 = ""
args.PredefinedSamples[1].SampleId.SampleId5 = ""
args.PredefinedSamples[1].SampleId.SampleId6 = ""
args.PredefinedSamples[1].SampleScopeName = "Samplescope1"
args.PredefinedSamples[1].ProductId = "e28c47e7-6060-4f49-8b47-475ba816388f"
args.PredefinedSamples[1].SampleChangerPosition = {}
-- this value may be "Undefined", "Absolute", "Relative", "DetectSample"
args.PredefinedSamples[1].SampleChangerPosition.ChangerPositionOrigin = "Absolute"
args.PredefinedSamples[1].SampleChangerPosition.Position = 4
args.MethodParameters = {}
args.MethodParameters[1] = {}
args.MethodParameters[1].MethodFunctionPropertyType = "Decimal"
args.MethodParameters[1].MethodFunctionPropertyValue = "10.5"
args.MethodParameters[1].MethodFunctionName = "Calculate"
args.MethodParameters[1].MethodFunctionPropertyName = "value"
args.MethodParameters[2] = {}
args.MethodParameters[2].MethodFunctionPropertyType = "Bool"
args.MethodParameters[2].MethodFunctionPropertyValue = true
args.MethodParameters[2].MethodFunctionName = "SetVisibility"
args.MethodParameters[2].MethodFunctionPropertyName = "visible"
args.MethodParameters[3] = {}
args.MethodParameters[3].MethodFunctionPropertyType = "DateTime"
args.MethodParameters[3].MethodFunctionPropertyValue = "2024-03-22T14:10:00"
args.MethodParameters[3].MethodFunctionName = "SetStart"
args.MethodParameters[3].MethodFunctionPropertyName = "startTime"
args.MethodParameters[4] = {}
args.MethodParameters[4].MethodFunctionPropertyType = "Enumeration"
args.MethodParameters[4].MethodFunctionPropertyValue = "A"
args.MethodParameters[4].MethodFunctionName = "SetType"
args.MethodParameters[4].MethodFunctionPropertyName = "type"
args.MethodParameters[5] = {}
args.MethodParameters[5].MethodFunctionPropertyType = "Integer"
args.MethodParameters[5].MethodFunctionPropertyValue = "15"
args.MethodParameters[5].MethodFunctionName = "SetValue"
args.MethodParameters[5].MethodFunctionPropertyName = "value"
args.MethodParameters[6] = {}
args.MethodParameters[6].MethodFunctionPropertyType = "String"
args.MethodParameters[6].MethodFunctionPropertyValue = "Test1"
args.MethodParameters[6].MethodFunctionName = "SetText"
args.MethodParameters[6].MethodFunctionPropertyName = "text1"
args.MethodParameters[7] = {}
args.MethodParameters[7].MethodFunctionPropertyType = "String"
args.MethodParameters[7].MethodFunctionPropertyValue = "Test2"
args.MethodParameters[7].MethodFunctionName = "SetText"
args.MethodParameters[7].MethodFunctionPropertyName = "text2"
local result, exception = lib:CREATESAMPLESERIES(args)
return (require "esi-string"):STRING({res=result,ex=exception})
Return Values
{
"res": {
"func": "CreateSampleSeries",
"farg": {
"PredefinedSamples": [
{
"MethodParameters": [
{
"Value": 1.5,
"$type": "LabXBridge.LabX.DecimalTypeMethodParameter, LabXBridge",
"MethodFunctionName": "CalculateWeight",
"MethodFunctionPropertyName": "value"
},
{
"Value": "Weigh a next sample",
"$type": "LabXBridge.LabX.StringTypeMethodParameter, LabXBridge",
"MethodFunctionName": "Weight1",
"MethodFunctionPropertyName": "instruction"
}
],
"ProductId": "e28c47e7-6060-4f49-8b47-475ba816388f",
"SampleScopeName": "Samplescope1",
"SampleChangerPosition": {
"Position": 4,
"ChangerPositionOrigin": "Absolute"
},
"SampleId": {
"SampleId2": "",
"SampleId3": "",
"SampleId1": "A",
"SampleId5": "",
"SampleId6": "",
"SampleId4": ""
}
},
{
"MethodParameters": [
{
"Value": 12.5,
"$type": "LabXBridge.LabX.DecimalTypeMethodParameter, LabXBridge",
"MethodFunctionName": "CalculateWeight",
"MethodFunctionPropertyName": "value"
},
{
"Value": "Weigh a sample",
"$type": "LabXBridge.LabX.StringTypeMethodParameter, LabXBridge",
"MethodFunctionName": "Weight1",
"MethodFunctionPropertyName": "instruction"
}
],
"ProductId": "e28c47e7-6060-4f49-8b47-475ba816388f",
"SampleScopeName": "Samplescope1",
"SampleChangerPosition": {
"Position": 3,
"ChangerPositionOrigin": "Absolute"
},
"SampleId": {
"SampleId2": "",
"SampleId3": "",
"SampleId1": "B",
"SampleId5": "",
"SampleId6": "",
"SampleId4": ""
}
}
],
"SampleSeriesHeader": {
"Comment": "This is test sample series",
"SeriesId": "myseriesid1",
"BusinessId": "7240bb39-dc6c-46ad-9f6f-677f380651b5",
"InternalId": "SR174",
"MethodBusinessId": "2e71a556-957d-4ef2-99a2-a0f254c5aaa7",
"Name": "Test sample series 1"
},
"MethodParameters": [
{
"Value": 10.5,
"$type": "LabXBridge.LabX.DecimalTypeMethodParameter, LabXBridge",
"MethodFunctionName": "Calculate",
"MethodFunctionPropertyName": "value"
},
{
"Value": true,
"$type": "LabXBridge.LabX.BoolTypeMethodParameter, LabXBridge",
"MethodFunctionName": "SetVisibility",
"MethodFunctionPropertyName": "visible"
},
{
"Value": "2024-03-22T14:10:00",
"$type": "LabXBridge.LabX.DateTimeTypeMethodParameter, LabXBridge",
"MethodFunctionName": "SetStart",
"MethodFunctionPropertyName": "startTime"
},
{
"Value": "A",
"$type": "LabXBridge.LabX.EnumerationTypeMethodParameter, LabXBridge",
"MethodFunctionName": "SetType",
"MethodFunctionPropertyName": "type"
},
{
"Value": 15,
"$type": "LabXBridge.LabX.IntegerTypeMethodParameter, LabXBridge",
"MethodFunctionName": "SetValue",
"MethodFunctionPropertyName": "value"
},
{
"Value": "Test1",
"$type": "LabXBridge.LabX.StringTypeMethodParameter, LabXBridge",
"MethodFunctionName": "SetText",
"MethodFunctionPropertyName": "text1"
},
{
"Value": "Test2",
"$type": "LabXBridge.LabX.StringTypeMethodParameter, LabXBridge",
"MethodFunctionName": "SetText",
"MethodFunctionPropertyName": "text2"
}
]
}
}
}
Exceptions
{"ex":[{"msg":"SampleSeriesValidationFault: Invalid sample serie can't be inserted: No samples for sample scope 'Samplescope1' defined.","Exception":true}]}
or
{"ex":[{"Exception":true,"msg":"SampleSeriesValidationFault: The value for 'Name' is incorrect. "}]}
or
{"ex":[{"Exception":true,"msg":"MethodNotExistFault: Method with id 2e71a556-957d-4ef2-99a2-a0f254c5aaa8 does not exist"}]}
or
{"ex":[{"Exception":true,"msg":"ProductNotExistFault: Product with id e28c47e7-6060-4f49-8b47-475ba816388a does not exist"}]}
or
{"ex": [{"Exception":true,"msg":"ValidationFault: Parameter 'visible' of method function 'SetVisibility' is obsolete."}]}
or
{"ex": {"tcp":"timeout","msg":"Error during TCP connection"}}
or
"connection refused"
REMOVESAMPLESERIES
REMOVESAMPLESERIES removes a sample series in LabX.
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.BusinessId = "609cee6d-e8a5-4d71-8ec7-ec73cf2948ee"
local result, exception = lib:REMOVESAMPLESERIES(args)
return (require "esi-string"):STRING({res=result,ex=exception})
Exceptions
{"ex": [{"Exception":false,"msg":"'x33fd37c-f37d-4dbe-b62d-90c8839b203d' is not valid guid"}]}
or
{"ex":[{"Exception":true,"msg":"SampleSerieNotExistFault: Sample series with id 9d2443fb-78ee-4276-994c-c1598c1ab6b1 does not exist"}]}
or
{"ex": {"tcp":"timeout","msg":"Error during TCP connection"}}
or
"connection refused"
CREATETASK
CREATETASK creates a task.
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.MethodBusinessId = "2e71a556-957d-4ef2-99a2-a0f254c5aaa7"
args.UserDefinedTaskId = "My Test task 2"
args.PriorityTask = false
args.SampleParameters = {}
args.SampleParameters[2] = {}
args.SampleParameters[2].MethodParameters = {}
args.SampleParameters[2].MethodParameters[1] = {}
args.SampleParameters[2].MethodParameters[1].MethodFunctionPropertyType = "Decimal"
args.SampleParameters[2].MethodParameters[1].MethodFunctionPropertyValue = "12.5"
args.SampleParameters[2].MethodParameters[1].MethodFunctionName = "CalculateWeight"
args.SampleParameters[2].MethodParameters[1].MethodFunctionPropertyName = "value"
args.SampleParameters[2].MethodParameters[2] = {}
args.SampleParameters[2].MethodParameters[2].MethodFunctionPropertyType = "String"
args.SampleParameters[2].MethodParameters[2].MethodFunctionPropertyValue = "Weigh a sample"
args.SampleParameters[2].MethodParameters[2].MethodFunctionName = "Weight1"
args.SampleParameters[2].MethodParameters[2].MethodFunctionPropertyName = "instruction"
args.SampleParameters[2].SampleId = {}
args.SampleParameters[2].SampleId.SampleId1 = "B"
args.SampleParameters[2].SampleId.SampleId2 = ""
args.SampleParameters[2].SampleId.SampleId3 = ""
args.SampleParameters[2].SampleId.SampleId4 = ""
args.SampleParameters[2].SampleId.SampleId5 = ""
args.SampleParameters[2].SampleId.SampleId6 = ""
args.SampleParameters[2].SampleScopeName = "Samplescope1"
args.SampleParameters[2].ProductId = "e28c47e7-6060-4f49-8b47-475ba816388f"
args.SampleParameters[2].SampleChangerPosition = {}
-- this value may be "Undefined", "Absolute", "Relative", "DetectSample"
args.SampleParameters[2].SampleChangerPosition.ChangerPositionOrigin = "Absolute"
args.SampleParameters[2].SampleChangerPosition.Position = 3
args.SampleParameters[1] = {}
args.SampleParameters[1].MethodParameters = {}
args.SampleParameters[1].MethodParameters[1] = {}
args.SampleParameters[1].MethodParameters[1].MethodFunctionPropertyType = "Decimal"
args.SampleParameters[1].MethodParameters[1].MethodFunctionPropertyValue = "1.5"
args.SampleParameters[1].MethodParameters[1].MethodFunctionName = "CalculateWeight"
args.SampleParameters[1].MethodParameters[1].MethodFunctionPropertyName = "value"
args.SampleParameters[1].MethodParameters[2] = {}
args.SampleParameters[1].MethodParameters[2].MethodFunctionPropertyType = "String"
args.SampleParameters[1].MethodParameters[2].MethodFunctionPropertyValue = "Weigh a next sample"
args.SampleParameters[1].MethodParameters[2].MethodFunctionName = "Weight1"
args.SampleParameters[1].MethodParameters[2].MethodFunctionPropertyName = "instruction"
args.SampleParameters[1].SampleId = {}
args.SampleParameters[1].SampleId.SampleId1 = "A"
args.SampleParameters[1].SampleId.SampleId2 = ""
args.SampleParameters[1].SampleId.SampleId3 = ""
args.SampleParameters[1].SampleId.SampleId4 = ""
args.SampleParameters[1].SampleId.SampleId5 = ""
args.SampleParameters[1].SampleId.SampleId6 = ""
args.SampleParameters[1].SampleScopeName = "Samplescope1"
args.SampleParameters[1].ProductId = "e28c47e7-6060-4f49-8b47-475ba816388f"
args.SampleParameters[1].SampleChangerPosition = {}
-- this value may be "Undefined", "Absolute", "Relative", "DetectSample"
args.SampleParameters[1].SampleChangerPosition.ChangerPositionOrigin = "Absolute"
args.SampleParameters[1].SampleChangerPosition.Position = 4
args.MethodParameters = {}
args.MethodParameters[1] = {}
args.MethodParameters[1].MethodFunctionPropertyType = "Decimal"
args.MethodParameters[1].MethodFunctionPropertyValue = "10.5"
args.MethodParameters[1].MethodFunctionName = "Calculate"
args.MethodParameters[1].MethodFunctionPropertyName = "value"
args.MethodParameters[2] = {}
args.MethodParameters[2].MethodFunctionPropertyType = "Bool"
args.MethodParameters[2].MethodFunctionPropertyValue = true
args.MethodParameters[2].MethodFunctionName = "SetVisibility"
args.MethodParameters[2].MethodFunctionPropertyName = "visible"
args.MethodParameters[3] = {}
args.MethodParameters[3].MethodFunctionPropertyType = "DateTime"
args.MethodParameters[3].MethodFunctionPropertyValue = "2024-03-22T14:10:00"
args.MethodParameters[3].MethodFunctionName = "SetStart"
args.MethodParameters[3].MethodFunctionPropertyName = "startTime"
args.MethodParameters[4] = {}
args.MethodParameters[4].MethodFunctionPropertyType = "Enumeration"
args.MethodParameters[4].MethodFunctionPropertyValue = "A"
args.MethodParameters[4].MethodFunctionName = "SetType"
args.MethodParameters[4].MethodFunctionPropertyName = "type"
args.MethodParameters[5] = {}
args.MethodParameters[5].MethodFunctionPropertyType = "Integer"
args.MethodParameters[5].MethodFunctionPropertyValue = "15"
args.MethodParameters[5].MethodFunctionName = "SetValue"
args.MethodParameters[5].MethodFunctionPropertyName = "value"
args.MethodParameters[6] = {}
args.MethodParameters[6].MethodFunctionPropertyType = "String"
args.MethodParameters[6].MethodFunctionPropertyValue = "Test1"
args.MethodParameters[6].MethodFunctionName = "SetText"
args.MethodParameters[6].MethodFunctionPropertyName = "text1"
args.MethodParameters[7] = {}
args.MethodParameters[7].MethodFunctionPropertyType = "String"
args.MethodParameters[7].MethodFunctionPropertyValue = "Test2"
args.MethodParameters[7].MethodFunctionName = "SetText"
args.MethodParameters[7].MethodFunctionPropertyName = "text2"
local result, exception = lib:CREATETASK(args)
return (require "esi-string"):STRING({res=result,ex=exception})
GETALLUSERS
GETALLUSERS returns all users defined in LabX (V13 method).
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
local result, exception = lib:GETALLUSERS()
return (require "esi-string"):STRING({res=result,ex=exception})
Return Values
{"res":
{
"MoreItems":false,
"func":"GetAllUsers",
"farg":
[
{
"LogOnName":"PredefinedUser",
"FullName":"Administrator",
"UserId":"5d5e746c-2030-4f12-baaf-55c422007a77",
"State":"Active"
},
{
"LogOnName":"test",
"FullName":"test",
"UserId":"9d4c93e0-4d20-43ea-bd81-33a94bdd4b49",
"State":"Active"
},
{
"LogOnName":"long",
"FullName":"very long name",
"UserId":"4eae4f32-174a-44df-836d-3ed0205a80e8",
"State":"Active"
}
]
}
}
GETALLROLES
GETALLROLES returns all user roles defined in LabX (V13 method).
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
local result, exception = lib:GETALLROLES()
return (require "esi-string"):STRING({res=result,ex=exception})
Return Values
{"res":
{
"MoreItems":false,
"func":"GetAllRoles",
"farg":
[
{
"Name":"MT Service",
"RoleId":"162e50f6-e786-416b-aaba-0d8fc489ca9e"
},
{
"Name":"Lab Administrator",
"RoleId":"f67230b5-db6f-4a45-9e8e-a88050e206c5"
},
{
"Name":"Lab Manager",
"RoleId":"4541bbaa-b0cf-4a57-ac48-edc312aac40b"
},
{
"Name":"Lab Technician",
"RoleId":"470f4dba-2a75-4fc9-abc9-4e662c6e2cdc"
},
{
"Name":"Lab Assistant",
"RoleId":"5c824f52-38a3-4fae-b2f5-40b6b712fac8"
}
]
}
}
Exceptions
{"ex": {"tcp":"timeout","msg":"Error during TCP connection"}}
or
{"ex":[{"Exception":false,"msg":"Missing \"RoleId\" property of the JSON object."}]}
or
{"ex":[{"Exception":false,"msg":"Missing \"TaskId\" property of the JSON object."}]}
or
{"ex":[{"Exception":false,"msg":"'5cb15cd9-4078-4c9b-9601-6bfbe73cf14eg' is not valid guid"}]}
or
"connection refused"
UNASSIGNTASKFROMUSER
UNASSIGNTASKFROMUSER removes the assignment of the task from a user (V13 method).
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.TaskId = "75ebfde4-8d35-4fc1-bffe-303fd302f6e0"
args.UserId = "5d5e746c-2030-4f12-baaf-55c422007a77"
local result, exception = lib:UNASSIGNTASKFROMUSER(args)
Exceptions
{"ex": {"tcp":"timeout","msg":"Error during TCP connection"}}
or
{"ex":[{"Exception":false,"msg":"Missing \"UserId\" property of the JSON object."}]}
or
{"ex":[{"Exception":false,"msg":"The creator of this fault did not specify a Reason."}]}
or
{"ex":[{"Exception":false,"msg":"Missing \"TaskId\" property of the JSON object."}]}
or
{"ex":[{"Exception":false,"msg":"'5cb15cd9-4078-4c9b-9601-6bfbe73cf14eg' is not valid guid"}]}
or
"connection refused"
UNASSIGNTASKFROMINSTRUMENT
UNASSIGNTASKFROMINSTRUMENT removes the assignment of the task from an instrument (V13 method).
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.TaskId = "75ebfde4-8d35-4fc1-bffe-303fd302f6e0"
args.InstrumentId = "1d8ac640-e155-44f6-8341-8090068ceae5"
local result, exception = lib:UNASSIGNTASKFROMINSTRUMENT(args)
Exceptions
{"ex": {"tcp":"timeout","msg":"Error during TCP connection"}}
or
{"ex":[{"Exception":false,"msg":"Missing \"InstrumentId\" property of the JSON object."}]}
or
{"ex":[{"Exception":false,"msg":"The creator of this fault did not specify a Reason."}]}
or
{"ex":[{"Exception":false,"msg":"Missing \"TaskId\" property of the JSON object."}]}
or
{"ex":[{"Exception":false,"msg":"'5cb15cd9-4078-4c9b-9601-6bfbe73cf14eg' is not valid guid"}]}
or
"connection refused"
ASSIGNTASKTOROLE
ASSIGNTASKTOROLE makes task visible only for users within a dedicated role, make use of this method immediately after having created the task (V13 method).
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.TaskId = "75ebfde4-8d35-4fc1-bffe-303fd302f6e0"
args.RoleId = "162e50f6-e786-416b-aaba-0d8fc489ca9e"
local result, exception = lib:ASSIGNTASKTOROLE(args)
Exceptions
{"ex": {"tcp":"timeout","msg":"Error during TCP connection"}}
or
{"ex":[{"Exception":false,"msg":"Missing \"RoleId\" property of the JSON object."}]}
or
{"ex":[{"Exception":false,"msg":"Missing \"TaskId\" property of the JSON object."}]}
or
{"ex":[{"Exception":false,"msg":"'5cb15cd9-4078-4c9b-9601-6bfbe73cf14eg' is not valid guid"}]}
or
"connection refused"
UNASSIGNTASKFROMROLE
UNASSIGNTASKFROMROLE removes the assignment of the task from a user role (V13 method).
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.TaskId = "75ebfde4-8d35-4fc1-bffe-303fd302f6e0"
args.RoleId = "162e50f6-e786-416b-aaba-0d8fc489ca9e"
local result, exception = lib:UNASSIGNTASKFROMROLE(args)
Exceptions
{"ex": {"tcp":"timeout","msg":"Error during TCP connection"}}
or
{"ex":[{"Exception":false,"msg":"Missing \"RoleId\" property of the JSON object."}]}
or
{"ex":[{"Exception":false,"msg":"Missing \"TaskId\" property of the JSON object."}]}
or
{"ex":[{"Exception":false,"msg":"The creator of this fault did not specify a Reason."}]}
or
{"ex":[{"Exception":false,"msg":"'5cb15cd9-4078-4c9b-9601-6bfbe73cf14eg' is not valid guid"}]}
or
"connection refused"
GETTASKSTATE
GETTASKSTATE returns the state of the task with the given unique identifier (V13 method).
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.TaskId = "75ebfde4-8d35-4fc1-bffe-303fd302f6e0"
local result, exception = lib:GETTASKSTATE(args)
GETTASKSTATECHANGE
GETTASKSTATECHANGE returns the state of the task with the given unique identifier (V13 method).
Parameters
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.TaskId = "75ebfde4-8d35-4fc1-bffe-303fd302f6e0"
args.Timeout = 3000
args.LastStateId = "74284ef3-0c35-b434-4972-9383802a5bbb"
local result, exception = lib:GETTASKSTATECHANGE(args)
CREATETASKFROMPRODUCT
CREATETASKFROMPRODUCT creates a task based on the product and method.
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.MethodBusinessId = "2e71a556-957d-4ef2-99a2-a0f254c5aaa7"
args.UserDefinedTaskId = "My Test task 2"
args.PriorityTask = false
args.ProductBusinessId = "e28c47e7-6060-4f49-8b47-475ba816388f"
args.SampleParameters = {}
args.SampleParameters[2] = {}
args.SampleParameters[2].MethodParameters = {}
args.SampleParameters[2].MethodParameters[1] = {}
args.SampleParameters[2].MethodParameters[1].MethodFunctionPropertyType = "Decimal"
args.SampleParameters[2].MethodParameters[1].MethodFunctionPropertyValue = "12.5"
args.SampleParameters[2].MethodParameters[1].MethodFunctionName = "CalculateWeight"
args.SampleParameters[2].MethodParameters[1].MethodFunctionPropertyName = "value"
args.SampleParameters[2].MethodParameters[2] = {}
args.SampleParameters[2].MethodParameters[2].MethodFunctionPropertyType = "String"
args.SampleParameters[2].MethodParameters[2].MethodFunctionPropertyValue = "Weigh a sample"
args.SampleParameters[2].MethodParameters[2].MethodFunctionName = "Weight1"
args.SampleParameters[2].MethodParameters[2].MethodFunctionPropertyName = "instruction"
args.SampleParameters[2].SampleId = {}
args.SampleParameters[2].SampleId.SampleId1 = "B"
args.SampleParameters[2].SampleId.SampleId2 = ""
args.SampleParameters[2].SampleId.SampleId3 = ""
args.SampleParameters[2].SampleId.SampleId4 = ""
args.SampleParameters[2].SampleId.SampleId5 = ""
args.SampleParameters[2].SampleId.SampleId6 = ""
args.SampleParameters[2].SampleScopeName = "Samplescope1"
args.SampleParameters[2].ProductId = "e3429820-fb16-4dc6-8de1-921ded0cc229"
args.SampleParameters[2].SampleChangerPosition = {}
-- this value may be "Undefined", "Absolute", "Relative", "DetectSample"
args.SampleParameters[2].SampleChangerPosition.ChangerPositionOrigin = "Absolute"
args.SampleParameters[2].SampleChangerPosition.Position = 3
args.SampleParameters[1] = {}
args.SampleParameters[1].MethodParameters = {}
args.SampleParameters[1].MethodParameters[1] = {}
args.SampleParameters[1].MethodParameters[1].MethodFunctionPropertyType = "Decimal"
args.SampleParameters[1].MethodParameters[1].MethodFunctionPropertyValue = "1.5"
args.SampleParameters[1].MethodParameters[1].MethodFunctionName = "CalculateWeight"
args.SampleParameters[1].MethodParameters[1].MethodFunctionPropertyName = "value"
args.SampleParameters[1].MethodParameters[2] = {}
args.SampleParameters[1].MethodParameters[2].MethodFunctionPropertyType = "String"
args.SampleParameters[1].MethodParameters[2].MethodFunctionPropertyValue = "Weigh a next sample"
args.SampleParameters[1].MethodParameters[2].MethodFunctionName = "Weight1"
args.SampleParameters[1].MethodParameters[2].MethodFunctionPropertyName = "instruction"
args.SampleParameters[1].SampleId = {}
args.SampleParameters[1].SampleId.SampleId1 = "A"
args.SampleParameters[1].SampleId.SampleId2 = ""
args.SampleParameters[1].SampleId.SampleId3 = ""
args.SampleParameters[1].SampleId.SampleId4 = ""
args.SampleParameters[1].SampleId.SampleId5 = ""
args.SampleParameters[1].SampleId.SampleId6 = ""
args.SampleParameters[1].SampleScopeName = "Samplescope1"
args.SampleParameters[1].ProductId = "e28c47e7-6060-4f49-8b47-475ba816388f"
args.SampleParameters[1].SampleChangerPosition = {}
-- this value may be "Undefined", "Absolute", "Relative", "DetectSample"
args.SampleParameters[1].SampleChangerPosition.ChangerPositionOrigin = "Absolute"
args.SampleParameters[1].SampleChangerPosition.Position = 4
args.MethodParameters = {}
args.MethodParameters[1] = {}
args.MethodParameters[1].MethodFunctionPropertyType = "Decimal"
args.MethodParameters[1].MethodFunctionPropertyValue = "10.5"
args.MethodParameters[1].MethodFunctionName = "Calculate"
args.MethodParameters[1].MethodFunctionPropertyName = "value"
args.MethodParameters[2] = {}
args.MethodParameters[2].MethodFunctionPropertyType = "Bool"
args.MethodParameters[2].MethodFunctionPropertyValue = true
args.MethodParameters[2].MethodFunctionName = "SetVisibility"
args.MethodParameters[2].MethodFunctionPropertyName = "visible"
args.MethodParameters[3] = {}
args.MethodParameters[3].MethodFunctionPropertyType = "DateTime"
args.MethodParameters[3].MethodFunctionPropertyValue = "2024-03-22T14:10:00"
args.MethodParameters[3].MethodFunctionName = "SetStart"
args.MethodParameters[3].MethodFunctionPropertyName = "startTime"
args.MethodParameters[4] = {}
args.MethodParameters[4].MethodFunctionPropertyType = "Enumeration"
args.MethodParameters[4].MethodFunctionPropertyValue = "A"
args.MethodParameters[4].MethodFunctionName = "SetType"
args.MethodParameters[4].MethodFunctionPropertyName = "type"
args.MethodParameters[5] = {}
args.MethodParameters[5].MethodFunctionPropertyType = "Integer"
args.MethodParameters[5].MethodFunctionPropertyValue = "15"
args.MethodParameters[5].MethodFunctionName = "SetValue"
args.MethodParameters[5].MethodFunctionPropertyName = "value"
args.MethodParameters[6] = {}
args.MethodParameters[6].MethodFunctionPropertyType = "String"
args.MethodParameters[6].MethodFunctionPropertyValue = "Test1"
args.MethodParameters[6].MethodFunctionName = "SetText"
args.MethodParameters[6].MethodFunctionPropertyName = "text1"
args.MethodParameters[7] = {}
args.MethodParameters[7].MethodFunctionPropertyType = "String"
args.MethodParameters[7].MethodFunctionPropertyValue = "Test2"
args.MethodParameters[7].MethodFunctionName = "SetText"
args.MethodParameters[7].MethodFunctionPropertyName = "text2"
local result, exception = lib:CREATETASKFROMPRODUCT(args)
return (require "esi-string"):STRING({res=result,ex=exception})
Return Values
{"res":{"farg":{"TaskId":"7140b75f-8f73-43e8-a401-718fc4d88993"},"func":"CreateTaskFromProduct"}}
Exceptions
{"ex":[{"Exception":true,"msg":"ProductNotExistFault: Product with id e28c47e7-6060-4f49-8b47-475ba8163881 does not exist"}]}
or
{"ex":[{"msg":"MethodNotExistFault: Method with id 2e71a556-957d-4ef2-99a2-a0f254c5aaa8 does not exist","Exception":true}]}
or
{"ex": {"tcp":"timeout","msg":"Error during TCP connection"}}
or
"connection refused"
CREATETASKFROMSERIES
CREATETASKFROMSERIES creates a task based on the series.
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.UserDefinedTaskId = "My Test task 2"
args.SeriesBusinessId = "f33fd37c-f37d-4dbe-b62d-90c8839b203d"
args.PriorityTask = false
local result, exception = lib:CREATETASKFROMSERIES(args)
return (require "esi-string"):STRING({res=result,ex=exception})
Return Values
{"res":{"func":"CreateTaskFromSeries","farg":{"TaskId":"304ac820-537c-4787-b869-f2c46ace40e6"}}}
Exceptions
{"ex":[{"Exception":true,"msg":"SampleSerieNotExistFault: Sample series with id 5cb15cd9-4078-4c9b-9601-6bfbe73cf141 does not exist"}]}
or
{"ex":[{"Exception":false,"msg":"'5cb15cd9-4078-4c9b-9601-6bfbe73cf14eg' is not valid guid"}]}
or
{"ex": {"tcp":"timeout","msg":"Error during TCP connection"}}
or
"connection refused"
CREATETASKFROMINSTANTSERIES
CREATETASKFROMINSTANTSERIES creates a task based on the defined series parameters.
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.MethodBusinessId = "2e71a556-957d-4ef2-99a2-a0f254c5aaa7"
args.UserDefinedTaskId = "My Test task 2"
args.Name = "My sample series"
args.Comment = ""
args.PriorityTask = false
args.PredefinedSamples = {}
args.PredefinedSamples[2] = {}
args.PredefinedSamples[2].MethodParameters = {}
args.PredefinedSamples[2].MethodParameters[1] = {}
args.PredefinedSamples[2].MethodParameters[1].MethodFunctionPropertyType = "Decimal"
args.PredefinedSamples[2].MethodParameters[1].MethodFunctionPropertyValue = "12.5"
args.PredefinedSamples[2].MethodParameters[1].MethodFunctionName = "CalculateWeight"
args.PredefinedSamples[2].MethodParameters[1].MethodFunctionPropertyName = "value"
args.PredefinedSamples[2].MethodParameters[2] = {}
args.PredefinedSamples[2].MethodParameters[2].MethodFunctionPropertyType = "String"
args.PredefinedSamples[2].MethodParameters[2].MethodFunctionPropertyValue = "Weigh a sample"
args.PredefinedSamples[2].MethodParameters[2].MethodFunctionName = "Weight1"
args.PredefinedSamples[2].MethodParameters[2].MethodFunctionPropertyName = "instruction"
args.PredefinedSamples[2].SampleId = {}
args.PredefinedSamples[2].SampleId.SampleId1 = "B"
args.PredefinedSamples[2].SampleId.SampleId2 = ""
args.PredefinedSamples[2].SampleId.SampleId3 = ""
args.PredefinedSamples[2].SampleId.SampleId4 = ""
args.PredefinedSamples[2].SampleId.SampleId5 = ""
args.PredefinedSamples[2].SampleId.SampleId6 = ""
args.PredefinedSamples[2].SampleScopeName = "Samplescope1"
args.PredefinedSamples[2].ProductId = "e28c47e7-6060-4f49-8b47-475ba816388f"
args.PredefinedSamples[2].SampleChangerPosition = {}
-- this value may be "Undefined", "Absolute", "Relative", "DetectSample"
args.PredefinedSamples[2].SampleChangerPosition.ChangerPositionOrigin = "Absolute"
args.PredefinedSamples[2].SampleChangerPosition.Position = 3
args.PredefinedSamples[1] = {}
args.PredefinedSamples[1].MethodParameters = {}
args.PredefinedSamples[1].MethodParameters[1] = {}
args.PredefinedSamples[1].MethodParameters[1].MethodFunctionPropertyType = "Decimal"
args.PredefinedSamples[1].MethodParameters[1].MethodFunctionPropertyValue = "1.5"
args.PredefinedSamples[1].MethodParameters[1].MethodFunctionName = "CalculateWeight"
args.PredefinedSamples[1].MethodParameters[1].MethodFunctionPropertyName = "value"
args.PredefinedSamples[1].MethodParameters[2] = {}
args.PredefinedSamples[1].MethodParameters[2].MethodFunctionPropertyType = "String"
args.PredefinedSamples[1].MethodParameters[2].MethodFunctionPropertyValue = "Weigh a next sample"
args.PredefinedSamples[1].MethodParameters[2].MethodFunctionName = "Weight1"
args.PredefinedSamples[1].MethodParameters[2].MethodFunctionPropertyName = "instruction"
args.PredefinedSamples[1].SampleId = {}
args.PredefinedSamples[1].SampleId.SampleId1 = "A"
args.PredefinedSamples[1].SampleId.SampleId2 = ""
args.PredefinedSamples[1].SampleId.SampleId3 = ""
args.PredefinedSamples[1].SampleId.SampleId4 = ""
args.PredefinedSamples[1].SampleId.SampleId5 = ""
args.PredefinedSamples[1].SampleId.SampleId6 = ""
args.PredefinedSamples[1].SampleScopeName = "Samplescope1"
args.PredefinedSamples[1].ProductId = "e28c47e7-6060-4f49-8b47-475ba816388f"
args.PredefinedSamples[1].SampleChangerPosition = {}
-- this value may be "Undefined", "Absolute", "Relative", "DetectSample"
args.PredefinedSamples[1].SampleChangerPosition.ChangerPositionOrigin = "Absolute"
args.PredefinedSamples[1].SampleChangerPosition.Position = 4
args.MethodParameters = {}
args.MethodParameters[1] = {}
args.MethodParameters[1].MethodFunctionPropertyType = "Decimal"
args.MethodParameters[1].MethodFunctionPropertyValue = "10.5"
args.MethodParameters[1].MethodFunctionName = "Calculate"
args.MethodParameters[1].MethodFunctionPropertyName = "value"
args.MethodParameters[2] = {}
args.MethodParameters[2].MethodFunctionPropertyType = "Bool"
args.MethodParameters[2].MethodFunctionPropertyValue = true
args.MethodParameters[2].MethodFunctionName = "SetVisibility"
args.MethodParameters[2].MethodFunctionPropertyName = "visible"
args.MethodParameters[3] = {}
args.MethodParameters[3].MethodFunctionPropertyType = "DateTime"
args.MethodParameters[3].MethodFunctionPropertyValue = "2024-03-22T14:10:00"
args.MethodParameters[3].MethodFunctionName = "SetStart"
args.MethodParameters[3].MethodFunctionPropertyName = "startTime"
args.MethodParameters[4] = {}
args.MethodParameters[4].MethodFunctionPropertyType = "Enumeration"
args.MethodParameters[4].MethodFunctionPropertyValue = "A"
args.MethodParameters[4].MethodFunctionName = "SetType"
args.MethodParameters[4].MethodFunctionPropertyName = "type"
args.MethodParameters[5] = {}
args.MethodParameters[5].MethodFunctionPropertyType = "Integer"
args.MethodParameters[5].MethodFunctionPropertyValue = "15"
args.MethodParameters[5].MethodFunctionName = "SetValue"
args.MethodParameters[5].MethodFunctionPropertyName = "value"
args.MethodParameters[6] = {}
args.MethodParameters[6].MethodFunctionPropertyType = "String"
args.MethodParameters[6].MethodFunctionPropertyValue = "Test1"
args.MethodParameters[6].MethodFunctionName = "SetText"
args.MethodParameters[6].MethodFunctionPropertyName = "text1"
args.MethodParameters[7] = {}
args.MethodParameters[7].MethodFunctionPropertyType = "String"
args.MethodParameters[7].MethodFunctionPropertyValue = "Test2"
args.MethodParameters[7].MethodFunctionName = "SetText"
args.MethodParameters[7].MethodFunctionPropertyName = "text2"
local result, exception = lib:CREATETASKFROMINSTANTSERIES(args)
return (require "esi-string"):STRING({res=result,ex=exception})
ASSIGNTASKTOINSTRUMENT
ASSIGNTASKTOINSTRUMENT assigns a created task to a specific instrument or instrument type.
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.InstrumentId = "1d8ac640-e155-44f6-8341-8090068ceae5"
args.TaskId = "f33fd37c-f37d-4dbe-b62d-90c8839b203d"
local result, exception = lib:ASSIGNTASKTOINSTRUMENT(args)
return (require "esi-string"):STRING({res=result,ex=exception})
Exceptions
{"ex":[{"msg":"InstrumentNotExistFault: Cannot find instrument with id 1d8ac640-e155-44f6-8341-8090068ceae4","Exception":true}]}
or
{"ex":[{"msg":"TaskNotExistFault: Exception of type 'MT.Sequoia.Platform.Common.ErrorHandling.TaskNotExistException' was thrown.","Exception":true}]}
or
{"ex":[{"Exception":false,"msg":"'e28c47e7-6060-4f49-8b47-475ba816388f' is not valid guid"}]}
or
{"ex": {"tcp":"timeout","msg":"Error during TCP connection"}}
or
"connection refused"
ASSIGNTASKTOUSER
ASSIGNTASKTOUSER assigns a created task to a specific user.
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.LogOnName = "PredefinedUser"
args.TaskId = "f33fd37c-f37d-4dbe-b62d-90c8839b203d"
local result, exception = lib:ASSIGNTASKTOUSER(args)
return (require "esi-string"):STRING({res=result,ex=exception})
Exceptions
{"ex":[{"Exception":true,"msg":"UserManagementFault: The logon name is incorrect"}]}
or
{"ex":[{"msg":"TaskNotExistFault: Exception of type 'MT.Sequoia.Platform.Common.ErrorHandling.TaskNotExistException' was thrown.","Exception":true}]}
or
{"ex":[{"Exception":false,"msg":"'e28c47e7-6060-4f49-8b47-475ba816388f' is not valid guid"}]}
or
{"ex": {"tcp":"timeout","msg":"Error during TCP connection"}}
or
"connection refused"
STARTTASK
STARTTASK starts a task.
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.InstrumentId = "1d8ac640-e155-44f6-8341-8090068ceae5"
args.TaskId = "f33fd37c-f37d-4dbe-b62d-90c8839b203d"
local result, exception = lib:STARTTASK(args)
return (require "esi-string"):STRING({res=result,ex=exception})
Exceptions
{"ex":[{"Exception":true,"msg":"InstrumentNotExistFault: Instrument with id 1d8ac640-e155-44f6-8341-8090068ceae1 does not exist"}]}
or
{"ex":[{"msg":"TaskNotExistFault: Exception of type 'MT.Sequoia.Platform.Common.ErrorHandling.TaskNotExistException' was thrown.","Exception":true}]}
or
{"ex":[{"Exception":false,"msg":"'e28c47e7-6060-4f49-8b47-475ba816388f' is not valid guid"}]}
or
{"ex": {"tcp":"timeout","msg":"Error during TCP connection"}}
or
"connection refused"
STARTTASKATWORKSPACE
STARTTASKATWORKSPACE starts a task.
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.InstrumentId = "1d8ac640-e155-44f6-8341-8090068ceae5"
args.TaskId = "f33fd37c-f37d-4dbe-b62d-90c8839b203d"
args.WorkspaceName = "WorkspaceB"
local result, exception = lib:STARTTASKATWORKSPACE(args)
return (require "esi-string"):STRING({res=result,ex=exception})
Exceptions
{"ex":[{"Exception":true,"msg":"InstrumentNotExistFault: Instrument with id 1d8ac640-e155-44f6-8341-8090068ceae1 does not exist"}]}
or
{"ex":[{"msg":"TaskNotExistFault: Exception of type 'MT.Sequoia.Platform.Common.ErrorHandling.TaskNotExistException' was thrown.","Exception":true}]}
or
{"ex":[{"Exception":false,"msg":"'e28c47e7-6060-4f49-8b47-475ba816388f' is not valid guid"}]}
or
{"ex": {"tcp":"timeout","msg":"Error during TCP connection"}}
or
"connection refused"
ABORTTASK
ABORTTASK aborts a running task.
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.TaskId = "f33fd37c-f37d-4dbe-b62d-90c8839b203d"
local result, exception = lib:ABORTTASK(args)
return (require "esi-string"):STRING({res=result,ex=exception})
Exceptions
{"ex":[{"msg":"TaskStateInvalidFault: Operation on task cannot be performed on current task state: Stopped","Exception":true}]}
or
{"ex":[{"msg":"TaskNotExistFault: Exception of type 'MT.Sequoia.Platform.Common.ErrorHandling.TaskNotExistException' was thrown.","Exception":true}]}
or
{"ex":[{"Exception":false,"msg":"'e28c47e7-6060-4f49-8b47-475ba816388f' is not valid guid"}]}
or
{"ex": {"tcp":"timeout","msg":"Error during TCP connection"}}
or
"connection refused"
PAUSETASK
PAUSETASK aborts a running task.
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.TaskId = "f33fd37c-f37d-4dbe-b62d-90c8839b203d"
local result, exception = lib:PAUSETASK(args)
return (require "esi-string"):STRING({res=result,ex=exception})
Exceptions
{"ex":[{"msg":"TaskStateInvalidFault: Operation on task cannot be performed on current task state: Created","Exception":true}]}
or
{"ex":[{"msg":"TaskStateInvalidFault: Operation on task cannot be performed on current task state: Stopped","Exception":true}]}
or
{"ex":[{"msg":"TaskNotExistFault: Exception of type 'MT.Sequoia.Platform.Common.ErrorHandling.TaskNotExistException' was thrown.","Exception":true}]}
or
{"ex":[{"Exception":false,"msg":"'e28c47e7-6060-4f49-8b47-475ba816388f' is not valid guid"}]}
or
{"ex": {"tcp":"timeout","msg":"Error during TCP connection"}}
or
"connection refused"
SUBSCRIBE
SUBSCRIBE creates subscription for LabX notifications.
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local result, exception = lib:SUBSCRIBE()
return (require "esi-string"):STRING({res=result,ex=exception})
UNSUBSCRIBE
UNSUBSCRIBE removes subscription for LabX notifications.
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local result, exception = lib:SUBSCRIBE()
local subscriptionHandle = result.farg.SubscriptionHandle
local args = {}
args.SubscriptionHandle = subscriptionHandle
result, exception = lib:UNSUBSCRIBE(args)
return (require "esi-string"):STRING({res=result,ex=exception})
REGISTERINSTRUMENTSTATENOTIFICATIONS
REGISTERINSTRUMENTSTATENOTIFICATIONS registers for getting instrument state change notifications for an particular instrument or for all instruments.
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local result, exception = lib:SUBSCRIBE()
local subscriptionHandle = result.farg.SubscriptionHandle
local args = {}
args.SubscriptionHandle = subscriptionHandle
args.InstrumentId = nil
result, exception = REGISTERINSTRUMENTSTATENOTIFICATIONS(args)
return (require "esi-string"):STRING({res=result,ex=exception})
UNREGISTERINSTRUMENTSTATENOTIFICATIONS
UNREGISTERINSTRUMENTSTATENOTIFICATIONS unregisters from receiving instrument state change notifications. It is not possible to unregister for a single instrument.
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local result, exception = lib:SUBSCRIBE()
local subscriptionHandle = result.farg.SubscriptionHandle
local params = {}
params.SubscriptionHandle = subscriptionHandle
params.InstrumentId = nil
REGISTERINSTRUMENTSTATENOTIFICATIONS(params)
local args = {}
args.SubscriptionHandle = subscriptionHandle
result, exception = UNREGISTERINSTRUMENTSTATENOTIFICATIONS(args)
return (require "esi-string"):STRING({res=result,ex=exception})
REGISTERTASKSTATENOTIFICATIONS
REGISTERTASKSTATENOTIFICATIONS registers for getting task state change and task data stored notifications for an particular task or for all tasks.
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local result, exception = lib:SUBSCRIBE()
local subscriptionHandle = result.farg.SubscriptionHandle
local args = {}
args.SubscriptionHandle = subscriptionHandle
args.TaskId = nil
result, exception = REGISTERTASKSTATENOTIFICATIONS(args)
return (require "esi-string"):STRING({res=result,ex=exception})
UNREGISTERTASKSTATENOTIFICATIONS
UNREGISTERTASKSTATENOTIFICATIONS unregisters from receiving task state change notifications and task data stored notifications. It is not possible to unregister for a single task.
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local result, exception = lib:SUBSCRIBE()
local subscriptionHandle = result.farg.SubscriptionHandle
local params = {}
params.SubscriptionHandle = subscriptionHandle
params.TaskId = nil
result, exception = REGISTERTASKSTATENOTIFICATIONS(params)
local args = {}
args.SubscriptionHandle = subscriptionHandle
result, exception = UNREGISTERTASKSTATENOTIFICATIONS(args)
return (require "esi-string"):STRING({res=result,ex=exception})
GETNOTIFICATIONS
GETNOTIFICATIONS returns notifications collected since the last call of GETNOTIFICATIONS() method.
Usage
local lib = require("esi-labxbridge")
local socket = require "socket"
lib:SETCONNECTION({})
local result, exception = lib:SUBSCRIBE()
local subscriptionHandle = result.farg.SubscriptionHandle
local params = {}
params.SubscriptionHandle = subscriptionHandle
params.TaskId = nil
REGISTERTASKSTATENOTIFICATIONS(params)
params = {}
params.SubscriptionHandle = subscriptionHandle
params.InstrumentId = nil
REGISTERINSTRUMENTSTATENOTIFICATIONS(params)
-- wait for a while
socket.sleep(120)
local args = {}
args.SubscriptionHandle = subscriptionHandle
result, exception = lib:GETNOTIFICATIONS(args)
if not exception then
if result.farg.Overflow then
-- there is the buffer overflow
-- GETNOTIFICATIONS() should be called more frequently
end
-- do something with the result and check if there are more notifications in the buffer
while result.farg.MoreNotifications do
result, exception = lib:GETNOTIFICATIONS(args)
-- do something with the result
end
end
return (require "esi-string"):STRING({res=result,ex=exception})
Return Values
{
"res": {
"func": "GetNotifications",
"farg": {
"MoreNotifications": false,
"Notifications": [
{
"Type": "TaskStateChange",
"Data": {
"CreationTime": "2024-04-10T05:19:47.9",
"TaskId": "1b91d72b-65c1-4ab7-aa6e-e61f08951d6f",
"AccountName": "PredefinedUser",
"TaskState": "Created",
"Name": "My Test task 3",
"MethodBusinessId": "2e71a556-957d-4ef2-99a2-a0f254c5aaa7",
"MethodName": "Simple Weighing (with Result)",
"InternalId": "T388"
}
},
{
"Type": "InstrumentStateChange",
"Data": {
"State": "Connected",
"InstrumentId": "1d8ac640-e155-44f6-8341-8090068ceae5"
}
},
{
"Type": "InstrumentStateChange",
"Data": {
"State": "Ready",
"InstrumentId": "1d8ac640-e155-44f6-8341-8090068ceae5"
}
},
{
"Type": "TaskStateChange",
"Data": {
"CreationTime": "2024-03-19T03:15:40.77",
"TaskId": "a2e9f33c-05a7-47a4-8305-08036b0b3191",
"AccountName": "PredefinedUser",
"TaskState": "Running",
"Name": "My Test task 3",
"MethodBusinessId": "2e71a556-957d-4ef2-99a2-a0f254c5aaa7",
"MethodName": "Simple Weighing (with Result)",
"InternalId": "T145"
}
},
{
"Type": "TaskDataStored",
"Data": {
"TaskId": "a2e9f33c-05a7-47a4-8305-08036b0b3191"
}
}
],
"Overflow": false
}
}
}
GETTASKRESULTS
GETTASKRESULTS returns one task result set belonging to the task with the specified task ID (GUID)
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.TaskId = "f33fd37c-f37d-4dbe-b62d-90c8839b203d"
local result, exception = lib:GETTASKRESULTS(args)
return (require "esi-string"):STRING({res=result,ex=exception})
Return Values
{ "res": {
"func": "GetTaskResults",
"farg": {
"Samples": [
{
"Results": [
{
"Instrument": {
"AvailableWorkspaces": [
"Default"
],
"Product": 1,
"InstrumentId": "1d8ac640-e155-44f6-8341-8090068ceae5",
"IsDeleted": false,
"SerialNumber": "1111122222/1111122222",
"ProductFamily": "BalanceExcellence",
"ExtendedProperties": {},
"AvailabilityStatus": "Disconnected",
"InstrumentName": "XPE205 Simulator",
"InternalId": "I6",
"InstrumentModel": "XPE205"
},
"UserLogonName": "PredefinedUser",
"Unit": "g",
"UserFullName": "Administrator",
"CreationTime": "2024-02-13T03:56:34.45",
"TaskId": "9d2443fb-78ee-4276-994c-c1598c1ab6b0",
"ResultName": "ResultNetWeight",
"OverallState":"Ok",
"InstrumentName": "XPE205 Simulator",
"InstrumentVersionId": "a7ef3bb0-d5fc-463b-9eaa-a04809b90774",
"Scalar": {
"Value": 77.0,
"Precision": 5
}
}
],
"SampleStartTime": "2024-02-13T03:51:38.48",
"OverallState":"Ok",
"SampleId": {
"SampleId3": "",
"SampleId1": "sample1",
"SampleId5": "",
"SampleId6": "",
"SampleId2": "",
"SampleId4": ""
}
},
{
"Results": [
{
"Instrument": {
"AvailableWorkspaces": [
"Default"
],
"Product": 1,
"InstrumentId": "1d8ac640-e155-44f6-8341-8090068ceae5",
"IsDeleted": false,
"SerialNumber": "1111122222/1111122222",
"ProductFamily": "BalanceExcellence",
"ExtendedProperties": {},
"AvailabilityStatus": "Disconnected",
"InstrumentName": "XPE205 Simulator",
"InternalId": "I6",
"InstrumentModel": "XPE205"
},
"UserLogonName": "PredefinedUser",
"Unit": "g",
"UserFullName": "Administrator",
"CreationTime": "2024-02-13T03:57:14.84",
"TaskId": "9d2443fb-78ee-4276-994c-c1598c1ab6b0",
"ResultName": "ResultNetWeight",
"OverallState":"Ok",
"InstrumentName": "XPE205 Simulator",
"InstrumentVersionId": "a7ef3bb0-d5fc-463b-9eaa-a04809b90774",
"Scalar": {
"Value": 67.375,
"Precision": 5
}
}
],
"SampleStartTime": "2024-02-13T03:56:50.02",
"OverallState":"Ok",
"SampleId": {
"SampleId1": "sample 2",
"SampleId2": "",
"SampleId3": "",
"SampleId4": "",
"SampleId5": "",
"SampleId6": "",
}
},
{
"Results": [
{
"Instrument": {
"AvailableWorkspaces": [
"Default"
],
"Product": 1,
"InstrumentId": "1d8ac640-e155-44f6-8341-8090068ceae5",
"IsDeleted": false,
"SerialNumber": "1111122222/1111122222",
"ProductFamily": "BalanceExcellence",
"ExtendedProperties": {},
"AvailabilityStatus": "Disconnected",
"InstrumentName": "XPE205 Simulator",
"InternalId": "I6",
"InstrumentModel": "XPE205"
},
"UserLogonName": "PredefinedUser",
"Unit": "g",
"UserFullName": "Administrator",
"CreationTime": "2024-02-13T03:58:30.28",
"TaskId": "9d2443fb-78ee-4276-994c-c1598c1ab6b0",
"ResultName": "ResultNetWeight",
"OverallState":"Ok",
"InstrumentName": "XPE205 Simulator",
"InstrumentVersionId": "a7ef3bb0-d5fc-463b-9eaa-a04809b90774",
"Scalar": {
"Value": 35.8375,
"Precision": 5
}
}
],
"SampleStartTime": "2024-02-13T03:57:58.9",
"OverallState":"Ok",
"SampleId": {
"SampleId3": "",
"SampleId1": "sample 3",
"SampleId5": "",
"SampleId6": "",
"SampleId2": "",
"SampleId4": ""
}
}
],
"TaskResults": [],
"Task": {
"TaskState": "Completed",
"TaskId": "9d2443fb-78ee-4276-994c-c1598c1ab6b0",
"CreationTime": "2024-02-13T03:50:54.61",
"Name": "T14_Simple Weighing (with Result)",
"MethodName": "Simple Weighing (with Result)",
"InternalId": "T14",
"MethodBusinessId": "2e71a556-957d-4ef2-99a2-a0f254c5aaa7",
"AccountName": "PredefinedUser"
},
"IsApproved": false,
"OverallState":"Ok"
}
}
}
Exceptions
{"ex": [{"Exception":false,"msg":"'x33fd37c-f37d-4dbe-b62d-90c8839b203d' is not valid guid"}]}
or
{"ex":[{"Exception":true,"msg":"TaskNotExistFault: Exception of type 'MT.Sequoia.Platform.Common.ErrorHandling.TaskNotExistException' was thrown."}]}
or
{"ex": {"tcp":"timeout","msg":"Error during TCP connection"}}
or
"connection refused"
GETTASKRESULTSINRANGE
GETTASKRESULTSINRANGE returns the list with all task result sets in LabX that were created in the range of the specified FromDate and ToDate. The date range must not exceed 3 days per call.
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.FromDate = "2024-02-13T09:59:59"
args.ToDate = "2024-02-14T23:59:59"
args.MaxNumberOfRecords = 2
local result, exception = lib:GETTASKRESULTSINRANGE(args)
if exception then
return (require "esi-string"):STRING({ex=exception})
else
if result.MoreItems then
local cargs = {}
cargs.ContinuationKey = result.ContinuationKey
while true do
local lresult, exception = lib:GETCONTINUATION(cargs)
if exception then
return (require "esi-string"):STRING({ex=exception})
end
for ii=1,#lresult.farg do
result.farg[#result.farg+1] = lresult.farg[ii]
end
if not lresult.MoreItems then
break
end
end
end
end
return (require "esi-string"):STRING({res=result,ex=exception})
Return Values
{ "res": {
"farg": [
{
"Samples": [
{
"Results": [
{"TaskId":"f33fd37c-f37d-4dbe-b62d-90c8839b203d","CreationTime": "2024-02-13T04:30:01.41",
"Instrument": {
"IsDeleted": false,
"ProductFamily": "BalanceExcellence",
"InternalId": "I6",
"Product": 1,
"SerialNumber": "1111122222/1111122222",
"InstrumentName": "XPE205 Simulator",
"InstrumentId": "1d8ac640-e155-44f6-8341-8090068ceae5",
"AvailabilityStatus": "Disconnected",
"ExtendedProperties": {},
"AvailableWorkspaces": [
"Default"
],
"InstrumentModel": "XPE205"
},
"InstrumentVersionId": "a7ef3bb0-d5fc-463b-9eaa-a04809b90774",
"InstrumentName": "XPE205 Simulator",
"UserFullName": "Administrator",
"ResultName": "Result1",
"OverallState":"Ok",
"UserLogonName": "PredefinedUser",
"Scalar": {
"Value": 55.125,
"Precision": 5
},
"Unit": "g"
}
],
"SampleStartTime": "2024-02-13T04:29:51.2",
"OverallState":"Ok",
"SampleId": {
"SampleId4": "",
"SampleId2": "",
"SampleId3": "",
"SampleId5": "",
"SampleId1": "sample7",
"SampleId6": ""
}
},
{
"Results": [
{
"TaskId": "f33fd37c-f37d-4dbe-b62d-90c8839b203d",
"CreationTime": "2024-02-13T04:30:30.35",
"Instrument": {
"IsDeleted": false,
"ProductFamily": "BalanceExcellence",
"InternalId": "I6",
"Product": 1,
"SerialNumber": "1111122222/1111122222",
"InstrumentName": "XPE205 Simulator",
"InstrumentId": "1d8ac640-e155-44f6-8341-8090068ceae5",
"AvailabilityStatus": "Disconnected",
"ExtendedProperties": {},
"AvailableWorkspaces": [
"Default"
],
"InstrumentModel": "XPE205"
},
"InstrumentVersionId": "a7ef3bb0-d5fc-463b-9eaa-a04809b90774",
"InstrumentName": "XPE205 Simulator",
"UserFullName": "Administrator",
"ResultName": "Result1",
"OverallState":"Ok",
"UserLogonName": "PredefinedUser",
"Scalar": {
"Value": 0.0,
"Precision": 5
},
"Unit": "g"
}
],
"SampleStartTime": "2024-02-13T04:30:20.19",
"OverallState":"Ok",
"SampleId": {
"SampleId4": "",
"SampleId2": "",
"SampleId3": "",
"SampleId5": "",
"SampleId1": "sample 8",
"SampleId6": ""
}
},
{
"Results": [
{
"TaskId": "f33fd37c-f37d-4dbe-b62d-90c8839b203d",
"CreationTime": "2024-02-13T04:31:11.06",
"Instrument": {
"IsDeleted": false,
"ProductFamily": "BalanceExcellence",
"InternalId": "I6",
"Product": 1,
"SerialNumber": "1111122222/1111122222",
"InstrumentName": "XPE205 Simulator",
"InstrumentId": "1d8ac640-e155-44f6-8341-8090068ceae5",
"AvailabilityStatus": "Disconnected",
"ExtendedProperties": {},
"AvailableWorkspaces": [
"Default"
],
"InstrumentModel": "XPE205"
},
"InstrumentVersionId": "a7ef3bb0-d5fc-463b-9eaa-a04809b90774",
"InstrumentName": "XPE205 Simulator",
"UserFullName": "Administrator",
"ResultName": "Result1",
"OverallState":"Ok",
"UserLogonName": "PredefinedUser",
"Scalar": {
"Value": 0.0,
"Precision": 5
},
"Unit": "g"
}
],
"SampleStartTime": "2024-02-13T04:30:37.95",
"OverallState":"Ok",
"SampleId": {
"SampleId4": "",
"SampleId2": "",
"SampleId3": "",
"SampleId5": "",
"SampleId1": "sample 9",
"SampleId6": ""
}
}
],
"IsApproved": false,
"Task": {
"MethodBusinessId": "3dae4bfa-814e-4101-88e3-f38d7c821b6c",
"Name": "Sample scope only",
"CreationTime": "2024-02-13T04:29:28.89",
"TaskState": "Waiting",
"TaskId": "f33fd37c-f37d-4dbe-b62d-90c8839b203d",
"MethodName": "Sample scope only",
"AccountName": "PredefinedUser",
"InternalId": "T16"
},
"TaskResults": [],
"OverallState":"Ok"
},
{
"Samples": [],
"IsApproved": false,
"OverallState":"Ok",
"Task": {
"MethodBusinessId": "3dae4bfa-814e-4101-88e3-f38d7c821b6c",
"Name": "Sample scope only",
"CreationTime": "2024-02-13T04:01:52.4",
"TaskState": "Created",
"TaskId": "01456f1f-ea45-4630-9af5-94709ef9c1f9",
"MethodName": "Sample scope only",
"AccountName": "PredefinedUser",
"InternalId": "T15"
},
"TaskResults": []
},
{
"Samples": [
{
"Results": [
{
"TaskId": "9d2443fb-78ee-4276-994c-c1598c1ab6b0",
"CreationTime": "2024-02-13T03:56:34.45",
"Instrument": {
"IsDeleted": false,
"ProductFamily": "BalanceExcellence",
"InternalId": "I6",
"Product": 1,
"SerialNumber": "1111122222/1111122222",
"InstrumentName": "XPE205 Simulator",
"InstrumentId": "1d8ac640-e155-44f6-8341-8090068ceae5",
"AvailabilityStatus": "Disconnected",
"ExtendedProperties": {},
"AvailableWorkspaces": [
"Default"
],
"InstrumentModel": "XPE205"
},
"InstrumentVersionId": "a7ef3bb0-d5fc-463b-9eaa-a04809b90774",
"InstrumentName": "XPE205 Simulator",
"UserFullName": "Administrator",
"ResultName": "ResultNetWeight",
"OverallState":"Ok",
"UserLogonName": "PredefinedUser",
"Scalar": {
"Value": 77.0,
"Precision": 5
},
"Unit": "g"
}
],
"SampleStartTime": "2024-02-13T03:51:38.48",
"OverallState":"Ok",
"SampleId": {
"SampleId4": "",
"SampleId2": "",
"SampleId3": "",
"SampleId5": "",
"SampleId1": "sample1",
"SampleId6": ""
}
},
{
"Results": [
{
"TaskId": "9d2443fb-78ee-4276-994c-c1598c1ab6b0",
"CreationTime": "2024-02-13T03:57:14.84",
"Instrument": {
"IsDeleted": false,
"ProductFamily": "BalanceExcellence",
"InternalId": "I6",
"Product": 1,
"SerialNumber": "1111122222/1111122222",
"InstrumentName": "XPE205 Simulator",
"InstrumentId": "1d8ac640-e155-44f6-8341-8090068ceae5",
"AvailabilityStatus": "Disconnected",
"ExtendedProperties": {},
"AvailableWorkspaces": [
"Default"
],
"InstrumentModel": "XPE205"
},
"InstrumentVersionId": "a7ef3bb0-d5fc-463b-9eaa-a04809b90774",
"InstrumentName": "XPE205 Simulator",
"UserFullName": "Administrator",
"ResultName": "ResultNetWeight",
"OverallState":"Ok",
"UserLogonName": "PredefinedUser",
"Scalar": {
"Value": 67.375,
"Precision": 5
},
"Unit": "g"
}
],
"SampleStartTime": "2024-02-13T03:56:50.02",
"OverallState":"Ok",
"SampleId": {
"SampleId4": "",
"SampleId2": "",
"SampleId3": "",
"SampleId5": "",
"SampleId1": "sample 2",
"SampleId6": ""
}
},
],
"IsApproved": false,
"OverallState":"Ok",
"Task": {
"MethodBusinessId": "2e71a556-957d-4ef2-99a2-a0f254c5aaa7",
"Name": "T14_Simple Weighing (with Result)",
"CreationTime": "2024-02-13T03:50:54.61",
"TaskState": "Completed",
"TaskId": "9d2443fb-78ee-4276-994c-c1598c1ab6b0",
"MethodName": "Simple Weighing (with Result)",
"AccountName": "PredefinedUser",
"InternalId": "T14"
},
"TaskResults": []
},
{
"Samples": [],
"IsApproved": false,
"OverallState":"Ok",
"Task": {
"MethodBusinessId": "2e71a556-957d-4ef2-99a2-a0f254c5aaa7",
"Name": "Weighing (Result)",
"CreationTime": "2024-02-13T03:18:48.44",
"TaskState": "Aborted",
"TaskId": "b8ac912e-5b3d-47fa-bc48-7a4c75d0a783",
"MethodName": "Simple Weighing (with Result)",
"AccountName": "PredefinedUser",
"InternalId": "T13"
},
"TaskResults": []
},
{
"Samples": [
{
"Results": [],
"SampleStartTime": "2024-02-13T03:25:22.76",
"OverallState":"Ok",
"SampleId": {
"SampleId4": "",
"SampleId2": "",
"SampleId3": "",
"SampleId5": "",
"SampleId1": "Sample XXX",
"SampleId6": ""
}
},
{
"Results": [],
"SampleStartTime": "2024-02-13T03:26:52.32",
"OverallState":"Ok",
"SampleId": {
"SampleId4": "",
"SampleId2": "",
"SampleId3": "",
"SampleId5": "",
"SampleId1": "Sample YYY",
"SampleId6": ""
}
},
{
"Results": [],
"SampleStartTime": "2024-02-13T03:34:30.89",
"OverallState":"Ok",
"SampleId": {
"SampleId4": "",
"SampleId2": "",
"SampleId3": "",
"SampleId5": "",
"SampleId1": "Sample AAA",
"SampleId6": ""
}
},
{
"Results": [],
"SampleStartTime": "2024-02-13T04:02:37.9",
"OverallState":"Ok",
"SampleId": {
"SampleId4": "",
"SampleId2": "",
"SampleId3": "",
"SampleId5": "",
"SampleId1": "sample 4",
"SampleId6": ""
}
},
{
"Results": [],
"SampleStartTime": "2024-02-13T04:02:50.55",
"OverallState":"Ok",
"SampleId": {
"SampleId4": "",
"SampleId2": "",
"SampleId3": "",
"SampleId5": "",
"SampleId1": "sample 5",
"SampleId6": ""
}
},
{
"Results": [],
"SampleStartTime": "2024-02-13T04:04:50.59",
"OverallState":"Ok",
"SampleId": {
"SampleId4": "",
"SampleId2": "",
"SampleId3": "",
"SampleId5": "",
"SampleId1": "sample 6",
"SampleId6": ""
}
},
{
"Results": [],
"SampleStartTime": "2024-02-13T04:05:38.83",
"OverallState":"Ok",
"SampleId": {
"SampleId4": "",
"SampleId2": "",
"SampleId3": "",
"SampleId5": "",
"SampleId1": "sample 7",
"SampleId6": ""
}
}
],
"IsApproved": false,
"OverallState":"Ok",
"Task": {
"MethodBusinessId": "3dae4bfa-814e-4101-88e3-f38d7c821b6c",
"Name": "Sample scope only",
"CreationTime": "2024-02-13T03:17:43.87",
"TaskState": "Paused",
"TaskId": "eaaf5ad1-dc97-40fc-bbb6-3538e6713538",
"MethodName": "Sample scope only",
"AccountName": "PredefinedUser",
"InternalId": "T12"
},
"TaskResults": []
},
{
"Samples": [
{
"Results": [
{
"TaskId": "c78d363e-8efc-4eeb-8ad6-e4c01009bec4",
"CreationTime": "2024-02-13T02:58:25.34",
"Instrument": {
"IsDeleted": false,
"ProductFamily": "BalanceExcellence",
"InternalId": "I6",
"Product": 1,
"SerialNumber": "1111122222/1111122222",
"InstrumentName": "XPE205 Simulator",
"InstrumentId": "1d8ac640-e155-44f6-8341-8090068ceae5",
"AvailabilityStatus": "Disconnected",
"ExtendedProperties": {},
"AvailableWorkspaces": [
"Default"
],
"InstrumentModel": "XPE205"
},
"InstrumentVersionId": "a7ef3bb0-d5fc-463b-9eaa-a04809b90774",
"InstrumentName": "XPE205 Simulator",
"UserFullName": "Administrator",
"ResultName": "ResultNetWeight",
"OverallState":"Ok",
"UserLogonName": "PredefinedUser",
"Scalar": {
"Value": 16.3421,
"Precision": 5
},
"Unit": "g"
}
],
"SampleStartTime": "2024-02-13T02:57:17.72",
"OverallState":"Ok",
"SampleId": {
"SampleId4": "",
"SampleId2": "",
"SampleId3": "",
"SampleId5": "",
"SampleId1": "4711id",
"SampleId6": ""
}
}
],
"IsApproved": false,
"OverallState":"Ok",
"Task": {
"MethodBusinessId": "2e71a556-957d-4ef2-99a2-a0f254c5aaa7",
"Name": "T11_Simple Weighing (with Result)",
"CreationTime": "2024-02-13T02:56:18.66",
"TaskState": "Completed",
"TaskId": "c78d363e-8efc-4eeb-8ad6-e4c01009bec4",
"MethodName": "Simple Weighing (with Result)",
"AccountName": "PredefinedUser",
"InternalId": "T11"
},
"TaskResults": []
}
],
"MoreItems": false,
"func": "GetTaskResultsInRange"
}
}
GETCONTINUATION
GETCONTINUATION returns the list with continuation of records.
Usage
local lib = require("esi-labxbridge")
lib:SETCONNECTION({})
local args = {}
args.FromDate = "2024-02-13T09:59:59"
args.ToDate = "2024-02-14T23:59:59"
args.MaxNumberOfRecords = 2
local result, exception = lib:GETALLTASKSINRANGE(args)
if exception then
return (require "esi-string"):STRING({ex=exception})
else
if result.MoreItems then
local cargs = {}
cargs.ContinuationKey = result.ContinuationKey
while true do
local lresult, exception = lib:GETCONTINUATION(cargs)
if exception then
return (require "esi-string"):STRING({ex=exception})
end
for ii=1,#lresult.farg do
result.farg[#result.farg+1] = lresult.farg[ii]
end
if not lresult.MoreItems then
break
end
end
end
end
return (require "esi-string"):STRING({res=result,ex=exception})
Return Values
{ "res": {
"MoreItems": true,
"ContinuationKey": "029f6d1d-d766-4b0c-9aec-cd11ad20e615",
"func": "GetAllTasksInRange",
"farg": [
{
"MethodBusinessId": "3dae4bfa-814e-4101-88e3-f38d7c821b6c",
"TaskState": "Paused",
"TaskId": "f33fd37c-f37d-4dbe-b62d-90c8839b203d",
"MethodName": "Sample scope only",
"InternalId": "T16",
"AccountName": "PredefinedUser",
"Name": "Sample scope only",
"CreationTime": "2024-02-13T04:29:28.89"
},
{
"MethodBusinessId": "3dae4bfa-814e-4101-88e3-f38d7c821b6c",
"TaskState": "Created",
"TaskId": "01456f1f-ea45-4630-9af5-94709ef9c1f9",
"MethodName": "Sample scope only",
"InternalId": "T15",
"AccountName": "PredefinedUser",
"Name": "Sample scope only",
"CreationTime": "2024-02-13T04:01:52.4"
},
{
"MethodBusinessId": "2e71a556-957d-4ef2-99a2-a0f254c5aaa7",
"TaskState": "Completed",
"TaskId": "9d2443fb-78ee-4276-994c-c1598c1ab6b0",
"MethodName": "Simple Weighing (with Result)",
"InternalId": "T14",
"AccountName": "PredefinedUser",
"Name": "T14_Simple Weighing (with Result)",
"CreationTime": "2024-02-13T03:50:54.61"
},
{
"MethodBusinessId": "3dae4bfa-814e-4101-88e3-f38d7c821b6c",
"TaskState": "Paused",
"TaskId": "eaaf5ad1-dc97-40fc-bbb6-3538e6713538",
"MethodName": "Sample scope only",
"InternalId": "T12",
"AccountName": "PredefinedUser",
"Name": "Sample scope only",
"CreationTime": "2024-02-13T03:17:43.87"
}
]
}
}