<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How do you get the result from queryExecutionClient.queryExecute()? in Developer Q&amp;A Forum</title>
    <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/How-do-you-get-the-result-from-queryExecutionClient-queryExecute/m-p/234085#M739</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/35901"&gt;@r_weber&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you don't add further props to the body, then this is expected behavior. you start a query and get as a result a request token you can use to poll for the result.&lt;/P&gt;
&lt;P&gt;But as part of body, you can add another property&amp;nbsp;&lt;SPAN&gt;requestTimeoutMilliseconds , where you would wait x milliseconds for the query to be executed. That should do the trick in your case&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;const result = await queryExecutionClient.queryExecute({
    body: {
      query,
      requestTimeoutMilliseconds: 30000
    }
  });&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;An easier way to query data is ou use the useDqlQuery hook,&amp;nbsp;&lt;A href="https://developer.dynatrace.com/develop/data/query-and-visualize/" target="_blank"&gt;https://developer.dynatrace.com/develop/data/query-and-visualize/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;BR /&gt;Sini&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 11 Jan 2024 17:55:26 GMT</pubDate>
    <dc:creator>sinisa_zubic</dc:creator>
    <dc:date>2024-01-11T17:55:26Z</dc:date>
    <item>
      <title>How do you get the result from queryExecutionClient.queryExecute()?</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/How-do-you-get-the-result-from-queryExecutionClient-queryExecute/m-p/234081#M738</link>
      <description>&lt;P&gt;What is wrong with this code? It's async, but shouldn't there be something in result (I verfified that the executed query returns data)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;async function getEntityName(entityId) {
  console.log(entityId)
  const eType = entityId.split('-')[0];
  console.log(eType);

  const query = 'fetch dt.entity.'+eType+' | filter id=="'+entityId+'"';
  console.log(query)
  const result = await queryExecutionClient.queryExecute({
    body: {
      query,
    }
  });
  console.log(result)
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"result" just shows:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
  result: undefined,
  ttlSeconds: 399,
  progress: undefined,
  requestToken: "jghsd2LVTPmQDTkWIl4QlQ==",
  state: "RUNNING"
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jan 2024 17:05:29 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/How-do-you-get-the-result-from-queryExecutionClient-queryExecute/m-p/234081#M738</guid>
      <dc:creator>r_weber</dc:creator>
      <dc:date>2024-01-11T17:05:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do you get the result from queryExecutionClient.queryExecute()?</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/How-do-you-get-the-result-from-queryExecutionClient-queryExecute/m-p/234085#M739</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/35901"&gt;@r_weber&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you don't add further props to the body, then this is expected behavior. you start a query and get as a result a request token you can use to poll for the result.&lt;/P&gt;
&lt;P&gt;But as part of body, you can add another property&amp;nbsp;&lt;SPAN&gt;requestTimeoutMilliseconds , where you would wait x milliseconds for the query to be executed. That should do the trick in your case&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;const result = await queryExecutionClient.queryExecute({
    body: {
      query,
      requestTimeoutMilliseconds: 30000
    }
  });&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;An easier way to query data is ou use the useDqlQuery hook,&amp;nbsp;&lt;A href="https://developer.dynatrace.com/develop/data/query-and-visualize/" target="_blank"&gt;https://developer.dynatrace.com/develop/data/query-and-visualize/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;BR /&gt;Sini&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jan 2024 17:55:26 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/How-do-you-get-the-result-from-queryExecutionClient-queryExecute/m-p/234085#M739</guid>
      <dc:creator>sinisa_zubic</dc:creator>
      <dc:date>2024-01-11T17:55:26Z</dc:date>
    </item>
    <item>
      <title>Re: How do you get the result from queryExecutionClient.queryExecute()?</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/How-do-you-get-the-result-from-queryExecutionClient-queryExecute/m-p/234087#M740</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/38283"&gt;@sinisa_zubic&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;the explicit addition of the requestTimeout should be documented and used in the examples!&lt;BR /&gt;This seems to work, now...&lt;/P&gt;&lt;P&gt;Btw. I started with useDqlQuery hook, but since I saw the same behavior I gave the executionClient a try. I will try the hook again...lets see what happens.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jan 2024 18:39:12 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/How-do-you-get-the-result-from-queryExecutionClient-queryExecute/m-p/234087#M740</guid>
      <dc:creator>r_weber</dc:creator>
      <dc:date>2024-01-11T18:39:12Z</dc:date>
    </item>
    <item>
      <title>Re: How do you get the result from queryExecutionClient.queryExecute()?</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/How-do-you-get-the-result-from-queryExecutionClient-queryExecute/m-p/234088#M741</link>
      <description>&lt;P&gt;The version with useDqlQuery crashes on me:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;async function getEntityName(entityId) {
  console.log(entityId)
  const eType = entityId.split('-')[0];
  console.log(eType);

  const query = 'fetch dt.entity.'+eType+' | filter id=="'+entityId+'"';
  console.log(query)
  /*const result = await queryExecutionClient.queryExecute({
    body: {
      query,
      requestTimeoutMilliseconds: 30000
    }
  });
*/
  const result = useDqlQuery({
    body: {
      query,
    },
  });
  console.log(result)
}&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;An error occurred: {"code": 541, "message": "Execution crashed.", "details": {"type": "BAD_REQUEST", "message": "&amp;lt;stripped secret anyhow::Error&amp;gt;"}}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jan 2024 18:43:43 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/How-do-you-get-the-result-from-queryExecutionClient-queryExecute/m-p/234088#M741</guid>
      <dc:creator>r_weber</dc:creator>
      <dc:date>2024-01-11T18:43:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do you get the result from queryExecutionClient.queryExecute()?</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/How-do-you-get-the-result-from-queryExecutionClient-queryExecute/m-p/234185#M750</link>
      <description>&lt;P&gt;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/35901"&gt;@r_weber&lt;/a&gt;&amp;nbsp;are you using the hooks in app functions? Hooks can only be used in your react code. For all other places besides your react code, I'd suggest using `queryExecutionClient` instead.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2024 12:53:03 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/How-do-you-get-the-result-from-queryExecutionClient-queryExecute/m-p/234185#M750</guid>
      <dc:creator>imsingh</dc:creator>
      <dc:date>2024-01-12T12:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: How do you get the result from queryExecutionClient.queryExecute()?</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/How-do-you-get-the-result-from-queryExecutionClient-queryExecute/m-p/234282#M752</link>
      <description>&lt;P&gt;OK, that wasn't clear. I tried to use it in a workflow.&lt;/P&gt;</description>
      <pubDate>Sun, 14 Jan 2024 19:45:32 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/How-do-you-get-the-result-from-queryExecutionClient-queryExecute/m-p/234282#M752</guid>
      <dc:creator>r_weber</dc:creator>
      <dc:date>2024-01-14T19:45:32Z</dc:date>
    </item>
  </channel>
</rss>

