Parameters (placeholder) in Grid on c# code possible
Hello Coresuite Community,
I have a short question, is it possbile like in SAP SQL queries or Grid configurator queries to use paramters on grids genertated by c# code?
In this code example is the parameter a string varable.
// get OINS.internalSN
string strItemID = TextEdit.GetFromUID(pVal.Form, "44").Value;
Grid grid = Grid.GetFromUID(pVal.Form, "COR_GR1");
string query = @"SELECT
T0.[callID] AS 'Abruf-Nr.'
, T0.[createDate] AS 'Erstellungsdatum'
, T0.[subject] AS 'Thema'
, T0.[custmrName] 'Geschäftspartner'
, T1.[Name] AS 'Status'
, T0.[U_SWA_CT_SubCode] AS 'Equipment-ID'
FROM OSCL T0
INNER JOIN OSCS T1 ON T0.status = T1.statusID
WHERE T0.[U_SWA_CT_SubCode] = '" + strItemID + @"'
ORDER BY T0.[callID]";
// ATTACH QUERY TO GRID
grid.ExecuteQuery(query);
But can I use the placeholder syntax in coded queries to, like...
WHERE T0.[U_SWA_CT_SubCode] = '$[$44.0.0]'
When I use the placeholder syntax in those queries, I get no result, because it search for '$[$44.0.0]' but not the value in the field.
Thanks in advance!
Sebastian
-
Hi Sebastian,
du kannst die Daten aus der Form holen
e.g.
string GPCode = TextEdit.GetFromUID(pVal.Form, "5").Value;
5 ist die ID die angezeigt wird wenn du die Systeminformationen anschaltest und dann mit der Maus drüber gehst.string UDFValue = SwissAddonFramework.UI.Components.ComboBox.GetFromUID(pVal.Form.UDFForm, "U_BPDtChg").Value
Bei UDF's ist es etwas anders. Hier ist es der Name aber mit einem anderem Aufruf.In der Query setzt du einen Platzhalter wie @@CardCode
Dann kannst du das ganze replacen und die Query ausführen
Query = Query.Replace("@@CardCode", "'" + GPCode + "'");Gruß
Lothar
0
Please sign in to leave a comment.
Comments
1 comment