Forum Discussion
here is the solution :
rest request :
http://localhost/GTSI_I2/server/odata/method.*method_name*
methode :[emoticon:9b06bfad0e6a482e801e5eb8fd9025d6]
Innovator inn = this.getInnovator();
var qry_id = "9D6022A8359748F7BB50AF18F6A41830"; // QD id
// get query definition with relationships
var queryDef = inn.newItem("qry_QueryDefinition","get");
queryDef.setID(qry_id);
queryDef.setAttribute("levels","10");
queryDef = queryDef.apply();
// execute query
queryDef.setAction("qry_ExecuteQueryDefinition");
queryDef.setAttribute("levels","10");
var res = queryDef.apply();
return res;
With this we got all the item type and their dependancy of the database.
Now I need to select only one choosen item type and his dependency.
any idea ?
thanks :)
Hello,
The easiest way to do this would be to add a parameter to your query definition to hold some identifying information about the item like the name. You can then add a condition to your query definition like 'Name = $my_name_param'. This will allow you to filter your query by passing in optional parameters.
In order to add this parameter programmatically, you can get the qry_QueryParameter relationship and set the value of that in order to filter your query. For example,
queryDef.getRelationships("qry_QueryParameter").getItemByIndex(0).setProperty("value", "My Specific Item Name");
If you're new to using parameters with query definitions, I'd recommend checking out the first part of this blog post which goes into more specific steps on how to set up and use a parameter.
Chris