<?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: Filtering an application that is using data from useDQL in Developer Q&amp;A Forum</title>
    <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Filtering-an-application-that-is-using-data-from-useDQL/m-p/284913#M1520</link>
    <description>&lt;P&gt;Hey there,&lt;BR /&gt;You are right. None of the existing examples we have uses data from a DQL query as a base.&lt;BR /&gt;&lt;BR /&gt;Here's a minimal example that does pretty much the same as&amp;nbsp;&lt;A href="https://developer.dynatrace.com/design/components-preview/filters/FilterBar/#render-filtered-data-in-a-table" target="_blank" rel="noopener"&gt;https://developer.dynatrace.com/design/components-preview/filters/FilterBar/#render-filtered-data-in-a-table&lt;/A&gt;&amp;nbsp;but uses data from a DQL query as a base.&lt;BR /&gt;&lt;BR /&gt;It fetches logs via DQL, shows them in a &lt;STRONG&gt;DataTableV2&lt;/STRONG&gt;, and allows simple filtering of the log level via a &lt;STRONG&gt;TextInput&lt;/STRONG&gt; in a &lt;STRONG&gt;FilterBar&lt;/STRONG&gt;.&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;import React from 'react';
import { Flex } from '@dynatrace/strato-components/layouts';
import { DataTableV2 } from '@dynatrace/strato-components-preview/tables';
import { useFilteredData } from '@dynatrace/strato-components-preview/tables';
import { FilterBar } from '@dynatrace/strato-components-preview/filters';
import { TextInput } from '@dynatrace/strato-components-preview/forms';
import { useDql } from '@dynatrace-sdk/react-hooks';

export const App = () =&amp;gt; {
  const queryString =
    'fetch logs | fields timestamp, loglevel, content | sort timestamp desc | limit 100';
  const { data } = useDql({ query: queryString });

  function filterFn(filters, entry) {
    const filterValue = filters.loglevel?.value ?? '';
    const loglevelValue =
      typeof entry.loglevel === 'string' ? entry.loglevel : '';
    return (
      !filterValue ||
      loglevelValue.toLowerCase().includes(filterValue.toLowerCase())
    );
  }

  const records = React.useMemo(() =&amp;gt; data?.records ?? [], [data?.records]);
  const { onChange, filteredData } = useFilteredData(records, filterFn);
  return (
    &amp;lt;Flex flexDirection="column" padding={32}&amp;gt;
      &amp;lt;FilterBar onFilterChange={onChange}&amp;gt;
        &amp;lt;FilterBar.Item name="loglevel" label="Log Level"&amp;gt;
          &amp;lt;TextInput /&amp;gt;
        &amp;lt;/FilterBar.Item&amp;gt;
      &amp;lt;/FilterBar&amp;gt;
      &amp;lt;DataTableV2
        columns={[
          { id: 'timestamp', header: 'Timestamp', accessor: 'timestamp' },
          { id: 'loglevel', header: 'Log Level', accessor: 'loglevel' },
          {
            id: 'content',
            header: 'Content',
            accessor: 'content',
            width: '2fr',
          },
        ]}
        data={filteredData}
        fullWidth
      /&amp;gt;
    &amp;lt;/Flex&amp;gt;
  );
};
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;I hope that helps!&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Sep 2025 09:48:52 GMT</pubDate>
    <dc:creator>doesterr</dc:creator>
    <dc:date>2025-09-09T09:48:52Z</dc:date>
    <item>
      <title>Filtering an application that is using data from useDQL</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Filtering-an-application-that-is-using-data-from-useDQL/m-p/284902#M1519</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I am developing an app for a user, using useDQL and an DatatablesV2 control. I am trying to create filters on the DatatableV2 using filtering controls (FilterBar), but none of the examples use DQL as a source and I cannot get filtering to work. Does Dynatrace have an example app that filters a DatatableV2 using data from useDQL (UseDqlResult/ResultRecord) type?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Aug 2025 14:12:45 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Filtering-an-application-that-is-using-data-from-useDQL/m-p/284902#M1519</guid>
      <dc:creator>johnacreek</dc:creator>
      <dc:date>2025-08-27T14:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering an application that is using data from useDQL</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Filtering-an-application-that-is-using-data-from-useDQL/m-p/284913#M1520</link>
      <description>&lt;P&gt;Hey there,&lt;BR /&gt;You are right. None of the existing examples we have uses data from a DQL query as a base.&lt;BR /&gt;&lt;BR /&gt;Here's a minimal example that does pretty much the same as&amp;nbsp;&lt;A href="https://developer.dynatrace.com/design/components-preview/filters/FilterBar/#render-filtered-data-in-a-table" target="_blank" rel="noopener"&gt;https://developer.dynatrace.com/design/components-preview/filters/FilterBar/#render-filtered-data-in-a-table&lt;/A&gt;&amp;nbsp;but uses data from a DQL query as a base.&lt;BR /&gt;&lt;BR /&gt;It fetches logs via DQL, shows them in a &lt;STRONG&gt;DataTableV2&lt;/STRONG&gt;, and allows simple filtering of the log level via a &lt;STRONG&gt;TextInput&lt;/STRONG&gt; in a &lt;STRONG&gt;FilterBar&lt;/STRONG&gt;.&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;import React from 'react';
import { Flex } from '@dynatrace/strato-components/layouts';
import { DataTableV2 } from '@dynatrace/strato-components-preview/tables';
import { useFilteredData } from '@dynatrace/strato-components-preview/tables';
import { FilterBar } from '@dynatrace/strato-components-preview/filters';
import { TextInput } from '@dynatrace/strato-components-preview/forms';
import { useDql } from '@dynatrace-sdk/react-hooks';

export const App = () =&amp;gt; {
  const queryString =
    'fetch logs | fields timestamp, loglevel, content | sort timestamp desc | limit 100';
  const { data } = useDql({ query: queryString });

  function filterFn(filters, entry) {
    const filterValue = filters.loglevel?.value ?? '';
    const loglevelValue =
      typeof entry.loglevel === 'string' ? entry.loglevel : '';
    return (
      !filterValue ||
      loglevelValue.toLowerCase().includes(filterValue.toLowerCase())
    );
  }

  const records = React.useMemo(() =&amp;gt; data?.records ?? [], [data?.records]);
  const { onChange, filteredData } = useFilteredData(records, filterFn);
  return (
    &amp;lt;Flex flexDirection="column" padding={32}&amp;gt;
      &amp;lt;FilterBar onFilterChange={onChange}&amp;gt;
        &amp;lt;FilterBar.Item name="loglevel" label="Log Level"&amp;gt;
          &amp;lt;TextInput /&amp;gt;
        &amp;lt;/FilterBar.Item&amp;gt;
      &amp;lt;/FilterBar&amp;gt;
      &amp;lt;DataTableV2
        columns={[
          { id: 'timestamp', header: 'Timestamp', accessor: 'timestamp' },
          { id: 'loglevel', header: 'Log Level', accessor: 'loglevel' },
          {
            id: 'content',
            header: 'Content',
            accessor: 'content',
            width: '2fr',
          },
        ]}
        data={filteredData}
        fullWidth
      /&amp;gt;
    &amp;lt;/Flex&amp;gt;
  );
};
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;I hope that helps!&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Sep 2025 09:48:52 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/Filtering-an-application-that-is-using-data-from-useDQL/m-p/284913#M1520</guid>
      <dc:creator>doesterr</dc:creator>
      <dc:date>2025-09-09T09:48:52Z</dc:date>
    </item>
  </channel>
</rss>

