GraphQLSendMutation
Syntax
GraphQLSendMutation("Verbindung", Mutation)
GraphQLSendMutation("Verbindung", Mutation, Variables)
GraphQLSendMutation("Verbindung", Mutation, Variables, CommandTimeout)
Beschreibung
Mit dieser Funktion werden Änderungen an Daten mittels GraphQL durchgeführt. Um eine GraphQL String zu erstellen kann die interaktiven GraphQL-Oberfläche von microtech verwendet werden, diese wird im Browser über die Verbindungs-URL geöffnet. Ausführliche Infos findet man auf der microtech Hilfeseite.
Parameter
•Verbindung: Name der GQL Anbindung. Diese wird in der Konfiguration unter Verbindungen konfiguriert. Siehe auch GraphQL in Büro+ einrichten.
•Mutation: GraphQL Mutation als Json String.
•Variables: Falls Variablen in der Mutation verwendet werden, dann müssen diese als Json String übergeben werden.
•CommandTimeout: Timeout in Sekunden. Wird diese Zeit überschritten wird die Abfragen mit einem Fehler abgebrochen.
Beispiel 1
-------------------------------------------------------------
-- Standard Mutation
-------------------------------------------------------------
Declare lGqlQuery as String
Declare lResult as String
lGqlQuery = @StartLongText
mutation {
tblProducts {
rowModify(exactMatch: { byNr: { kf1ArtNr: { string: "10002" } } }) {
fldSVtLaufZt(set: { int: 90 })
}
}
}
@EndLongText
lResult = GraphQLSendMutation("GraphQLAlphacom", lGqlQuery)
Beispiel 2
-------------------------------------------------------------
-- Mutation mit Variablen
-------------------------------------------------------------
Declare lGqlQuery as String
Declare lVariables as String
Declare lResult as String
Declare lValue as Integer
lGqlQuery = @StartLongText
mutation ($ArtNr: String $Value: Int) {
tblProducts {
rowModify(exactMatch: { byNr: { kf1ArtNr: { string: $ArtNr } } }) {
fldSVtLaufZt(set: { int: $Value })
}
}
}
@EndLongText
lVariables = @StartLongText
{
"ArtNr": "10002",
"Value": 100
}
@EndLongText
lResult = GraphQLSendMutation("GraphQLAlphacom", lGqlQuery, lVariables)
Beispiel 3
Declare lGqlQuery as String
Declare lResult as String
-------------------------------------------------------------
-- Vorgang Buchen
-------------------------------------------------------------
lGqlQuery = @StartLongText
mutation {
tblTransactions {
rowModify(
exactMatch: { byBelegNr: { kf1BelegNr: { string: "2025090001" } } }
) {
# Felder des Vorgangs abrufen
fldBelegNr
fldArt
fnPost {
fldBelegNr
}
}
}
}
@EndLongText
lResult = GraphQLSendMutation("GraphQLAlphacom", lGqlQuery)
-------------------------------------------------------------
-- Vorgang stornieren
-- Achtung: hier rowRead verwenden!!!
-------------------------------------------------------------
lGqlQuery = @StartLongText
mutation {
tblTransactions {
rowRead(
exactMatch: { byBelegNr: { kf1BelegNr: { string: "2025090001" } } }
) {
# Felder des Vorgangs abrufen
fldBelegNr
fldArt
fnReverse {
fldBelegNr
}
}
}
}
@EndLongText
lResult = GraphQLSendMutation("GraphQLAlphacom", lGqlQuery)
-------------------------------------------------------------
-- Vorgang wandeln
-------------------------------------------------------------
lGqlQuery = @StartLongText
mutation {
tblTransactions {
rowRead(
exactMatch: { byBelegNr: { kf1BelegNr: { string: "LS20250149" } } }
) {
fldBelegNr
fldArt
fnConvert {
# Hier müssen Sie die Felder von TBelegNrRecord angeben
fldBelegNr
# weitere verfügbare Felder des TBelegNrRecord
}
}
}
}
@EndLongText
lResult = GraphQLSendMutation("GraphQLAlphacom", lGqlQuery)