queryUsingPrimaryKeys()
Use the queryUsingPrimaryKeys() function to query the database using primary keys.
Syntax
Concept[] queryUsingPrimaryKeys(String conceptURI, SimpleEvent pKeyEvent, boolean queryChildren)
Here conceptURI is the URI of the concept type, pKeyEvent is a simple event that contains primary key values to be used. Properties must match primary key properties in the result concept. If queryChildren boolean is set to true, concept properties are recursively queried. The function returns an array of result concepts.
Example
Database.setCurrentConnection("/SharedResources/ibmi"); Database.beginTransaction(); EventsNew.ADBTEST1.TABLE_REFRING event = Event.createEvent("xslt://{{/EventsNew/ADBTEST1/TABLE_REFRING}}<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<xsl:stylesheet xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" version=\"1.0\" exclude-result-prefixes=\"xsl xsd\">\n <xsl:output method=\"xml\"/>\n <xsl:template match=\"/\">\n <createEvent>\n <event>\n <ID2>\n <xsl:value-of select=\"10\"/>\n </ID2>\n </event>\n </createEvent>\n </xsl:template>\n</xsl:stylesheet>"); Concepts.ADBTEST1.TABLE_REFRING [] parent = Database.queryUsingPrimaryKeys("/Concepts/ADBTEST1/TABLE_REFRING",event,true); for(int k = 0 ; k < parent@length ; k++ ) { System.debugOut(Instance.serializeUsingDefaults(parent[k])); } Database.unsetConnection();
Copyright © Cloud Software Group, Inc. All rights reserved.