SQL-Connector global variable in where-clause
-
steinhauer
Has successfully completed the online course Introduction
Has successfully completed the online course Intermediate (200)
5 years ago #17996In the SQL connector, the where part is used to filter for an order number. The order number is determined dynamically and is stored in the global variables in a struct, string would also be possible.
select * from orders where orderId = globalVariable
How do I have to define the struct/string as GlobalVariable?
Christian Kleinschroth
Has successfully completed the online course Introduction
Has successfully completed the online course Intermediate (200)
Has successfully completed the online course Advanced (300)
Has successfully completed the online course Basics (100)
Has successfully completed the online course Advanced (310)
Has successfully completed the online course Advanced (320)
Has successfully completed the Intermediate Certification
Has successfully completed the Advanced Certification
Mathieu Roll
Has successfully completed the online course Introduction
Has successfully completed the online course Intermediate (200)
Has successfully completed the online course Advanced (300)
Has successfully completed the online course Basics (100)
steinhauer
Has successfully completed the online course Introduction
Has successfully completed the online course Intermediate (200)
5 years ago #18012::Hello Malfurion,
thank you for your reply.
But something is wrong here. My where-clause is longer
where …
and …
and ..
and pur.t_orno =: gs_auftrag:When testing the connector, I get the following error message:
{
“message”: “Falsche Syntax in der Nähe von ‘:’.”,
“success”: false
}I tried like instead of =, the result remains the same.
gs_auftrag is a global variable of type string, which is initialized with a default value.
In the application I need a structure, gs_projekt.
I test:and pur.t_orno in( :gs_projekt:)
the result is unfortunately the same error message. With fixed Parameter
and pur.t_orno = ‘100023276’
the query works.
Mathieu Roll
Has successfully completed the online course Introduction
Has successfully completed the online course Intermediate (200)
Has successfully completed the online course Advanced (300)
Has successfully completed the online course Basics (100)
steinhauer
Has successfully completed the online course Introduction
Has successfully completed the online course Intermediate (200)
digitalysator
Has successfully completed the online course Introduction
Has successfully completed the online course Intermediate (200)
Has successfully completed the online course Advanced (300)
steinhauer
Has successfully completed the online course Introduction
Has successfully completed the online course Intermediate (200)
5 years ago #18390::Hi Thomas Gärtner,
sorry, the white spaces are not the problem, I tried
and pur.t_orno=:auftrag:String:
and the message is
{
“message”: “The index 2 is out of range.”,
“success”: false
}like before. My question is: What does the message mean? Where have I to look for the mistake? Is there any possibility for debugging?
and pur.t_orno = ‘100023276’
works fine.
jonas.rausch
Has successfully completed the online course Introduction
Has successfully completed the online course Intermediate (200)
Has successfully completed the online course Advanced (300)
Kahn
Has successfully completed the online course Introduction
Has successfully completed the online course Intermediate (200)
Has successfully completed the online course Advanced (300)
steinhauer
Has successfully completed the online course Introduction
Has successfully completed the online course Intermediate (200)
5 years ago #18395::First the query that works with fixed value:
select pur.t_otbp as Lieferant,
com.t_nama as Name,
pur.t_orno as Bestellung,
pur.t_pono as Position,
pur.t_sqnb as Folgenummer,
pur.t_item as Artikelnummer,
ibd.t_dsca as Artikelbeschreibung,
pur.t_qoor as Bestellmenge,
pur.t_qidl as ‘eingegangene Menge’,
pur.t_qibo as Nachlieferungsmenge,
pur.t_odat as Auftragsdatum,
pur.t_qiiv as ‘fakturierte Menge’,
pur.t_iamt as ‘Rechnungsbetrag’,
bes.t_ccur as Währung
from ttdpur401101 pur
inner join ttcibd001101 ibd on
pur.t_item = ibd.t_item
inner join ttdpur400101 bes on
bes.t_orno = pur.t_orno
inner join ttccom100101 com on
com.t_bpid = pur.t_otbp
where pur.t_item <> ‘ LE’
and pur.t_item <> ‘ HE’
and pur.t_item <> ‘ LLE’
and pur.t_orno = ‘100023276’
order by pur.t_otbp,pur.t_ornoand then the qoury that does not work, error see above:
select pur.t_otbp as Lieferant,
com.t_nama as Name,
pur.t_orno as Bestellung,
pur.t_pono as Position,
pur.t_sqnb as Folgenummer,
pur.t_item as Artikelnummer,
ibd.t_dsca as Artikelbeschreibung,
pur.t_qoor as Bestellmenge,
pur.t_qidl as ‘eingegangene Menge’,
pur.t_qibo as Nachlieferungsmenge,
pur.t_odat as Auftragsdatum,
pur.t_qiiv as ‘fakturierte Menge’,
pur.t_iamt as ‘Rechnungsbetrag’,
bes.t_ccur as Währung
from ttdpur401101 pur
inner join ttcibd001101 ibd on
pur.t_item = ibd.t_item
inner join ttdpur400101 bes on
bes.t_orno = pur.t_orno
inner join ttccom100101 com on
com.t_bpid = pur.t_otbp
where pur.t_item <> ‘ LE’
and pur.t_item <> ‘ HE’
and pur.t_item <> ‘ LLE’
and pur.t_orno=:auftrag:String:
order by pur.t_otbp,pur.t_ornoinput parameter: see file input parameter.
output parameter: see file output parameter
query result: see file query result.
Attachments:
You must be logged in to view attached files.Kahn
Has successfully completed the online course Introduction
Has successfully completed the online course Intermediate (200)
Has successfully completed the online course Advanced (300)
5 years ago #18400::You should have posted those screenshots much more early.
Please provide your parameter auftrag the following way params/auftrag you have to provide each named parameter this way
- params/MYPARAM1
- params/MYPARAM2
If you need to be more dynamic just provide params and chose a Structure as the DataType this way you can provide your parameter arbitrary.
Cheers
Kahn
steinhauer
Has successfully completed the online course Introduction
Has successfully completed the online course Intermediate (200)
5 years ago #18404::Is it possible, if I use a global variable, to simply display all parameters?
Do I really have to define all the parameters in the output individually?
I have another query with two parameters, where the output parameter “/” works correctly.I have now entered the output parameters “/params/Lieferant”, the error message has not changed.
Kahn
Has successfully completed the online course Introduction
Has successfully completed the online course Intermediate (200)
Has successfully completed the online course Advanced (300)
steinhauer
Has successfully completed the online course Introduction
Has successfully completed the online course Intermediate (200)
You must be logged in to reply to this topic.