<?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: Help with fine tuning a query using $arguments and enclosing them in &amp;quot;quotes&amp;quot; in Cortex XDR Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/help-with-fine-tuning-a-query-using-arguments-and-enclosing-them/m-p/1227520#M8255</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/816046735"&gt;@J.Suter&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;​&lt;SPAN class="relative -mx-px my-[-0.2rem] rounded px-px py-[0.2rem] transition-colors duration-100 ease-in-out"&gt;In Cortex XDR's XQL, when using parameters like &lt;CODE data-start="48" data-end="57"&gt;$Serial&lt;/CODE&gt; in your queries, it's essential to ensure that the parameter value is interpreted correctly, especially when dealing with string comparisons.&lt;/SPAN&gt; &lt;SPAN class="relative -mx-px my-[-0.2rem] rounded px-px py-[0.2rem] transition-colors duration-100 ease-in-out"&gt;The issue you're encountering arises because the &lt;CODE data-start="49" data-end="59"&gt;contains&lt;/CODE&gt; operator expects a string value, and if &lt;CODE data-start="100" data-end="109"&gt;$Serial&lt;/CODE&gt; isn't enclosed in quotes, the query may not function as intended.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="relative -mx-px my-[-0.2rem] rounded px-px py-[0.2rem] transition-colors duration-100 ease-in-out"&gt;dataset = xdr_data&lt;BR /&gt;| filter event_type = ENUM.FILE and event_sub_type = ENUM.FILE_CREATE_NEW&lt;BR /&gt;| alter Drive_Type = json_extract(to_json_string(action_file_device_info),"$.storage_device_drive_type"),&lt;BR /&gt;Filesystem = json_extract_scalar(to_json_string(action_file_device_info),"$.storage_device_filesystem"),&lt;BR /&gt;Drive_Letter = json_extract_scalar(to_json_string(action_file_device_info),"$.storage_device_mount_point"),&lt;BR /&gt;Device_Serial_Number = json_extract_scalar(to_json_string(action_file_device_info),"$.storage_device_serial_number")&lt;BR /&gt;| filter drive_type = "2"&lt;BR /&gt;| fields action_file_path as File_Path, actor_effective_username as Username, Filesystem, Drive_Letter, Device_Serial_Number&lt;BR /&gt;| filter Device_Serial_Number contains "$Serial"&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="relative -mx-px my-[-0.2rem] rounded px-px py-[0.2rem] transition-colors duration-100 ease-in-out"&gt;By enclosing &lt;CODE data-start="13" data-end="22"&gt;$Serial&lt;/CODE&gt; in double quotes within the query, you ensure that the parameter is treated as a string, aligning with the expectations of the &lt;CODE data-start="150" data-end="160"&gt;contains&lt;/CODE&gt; operator.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV id="CEG2AE8Q1-1595522554.142700-thread-list-Thread_1610462988.138100" class="c-virtual_list__item" tabindex="-1" role="listitem" aria-setsize="-1" data-qa="virtual-list-item" data-item-key="1610462988.138100"&gt;
&lt;DIV class="c-message_kit__background c-message_kit__background--hovered c-message_kit__message c-message_kit__thread_message" role="presentation" data-qa="message_container" data-qa-unprocessed="false" data-qa-placeholder="false"&gt;
&lt;DIV class="c-message_kit__hover c-message_kit__hover--hovered" role="document" aria-roledescription="message" data-qa-hover="true"&gt;
&lt;DIV class="c-message_kit__actions c-message_kit__actions--above"&gt;
&lt;DIV class="c-message_kit__gutter"&gt;
&lt;DIV class="c-message_kit__gutter__right" role="presentation" data-qa="message_content"&gt;
&lt;DIV class="c-message_kit__blocks c-message_kit__blocks--rich_text"&gt;
&lt;DIV class="c-message__message_blocks c-message__message_blocks--rich_text" data-qa="message-text"&gt;
&lt;DIV class="p-block_kit_renderer" data-qa="block-kit-renderer"&gt;
&lt;DIV class="p-block_kit_renderer__block_wrapper p-block_kit_renderer__block_wrapper--first"&gt;
&lt;DIV class="p-rich_text_block" dir="auto"&gt;
&lt;DIV class="p-rich_text_section"&gt;&lt;SPAN&gt;If you feel this has answered your query, please let us know by clicking like and&amp;nbsp; on "mark this as a Solution". Thank you.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV id="CEG2AE8Q1-1595522554.142700-thread-list-Thread_input" class="c-virtual_list__item" tabindex="-1" role="listitem" aria-setsize="-1" data-qa="virtual-list-item" data-item-key="input"&gt;
&lt;DIV class="p-threads_footer__input_container p-threads_footer__input_container--sticky_composer" data-qa="reply_container"&gt;
&lt;DIV class="p-threads_footer__input p-message_input_unstyled p-message_input_unstyled--attachments-visible p-message_input_unstyled--dark" role="group" aria-label="composer"&gt;
&lt;DIV class="p-message_input__input_container_unstyled c-wysiwyg_container c-wysiwyg_container--theme_dark c-wysiwyg_container--with_footer c-wysiwyg_container--theme_dark_bordered c-basic_container c-basic_container--size_medium" data-max-lines="16"&gt;
&lt;DIV class="c-basic_container__body"&gt;
&lt;DIV class="c-wysiwyg_container__formatting" role="toolbar" aria-orientation="horizontal" aria-label="Formatting" data-qa="wysiwyg-container_formatting-enabled"&gt;
&lt;DIV class="p-texty_sticky_formatting_bar"&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
    <pubDate>Mon, 28 Apr 2025 07:36:40 GMT</pubDate>
    <dc:creator>aspatil</dc:creator>
    <dc:date>2025-04-28T07:36:40Z</dc:date>
    <item>
      <title>Help with fine tuning a query using $arguments and enclosing them in "quotes"</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/help-with-fine-tuning-a-query-using-arguments-and-enclosing-them/m-p/1227461#M8254</link>
      <description>&lt;P&gt;I have the below query, and my issue is at the end, when the user puts in the argument for $Serial it needs to have quotes around it. I think it's because the JSON object it is looking at comes in "quotes" and that's how it filters. In other queries when I use $user it put quotes in the query for me. If I write "$Serial" it doesn't allow the argument. My users of Cortex won't know to add the serial in "quotes" in the search request when they use the query from the library.&lt;BR /&gt;&lt;BR /&gt;Any XQL coders out there have a suggestion to make this work without manually adding in the "quotes" around the serial every time?&lt;BR /&gt;&lt;LI-PRODUCT title="Cortex XDR" id="Cortex_XDR"&gt;&lt;/LI-PRODUCT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Update:&lt;/STRONG&gt; This only Happens when the serial is all numbers EG: 23456 Will not have quotes while 234S6 will have quotes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;dataset = xdr_data
 | filter event_type = ENUM.FILE and event_sub_type = ENUM.FILE_CREATE_NEW
 | alter Drive_Type = json_extract(to_json_string(action_file_device_info),"$.storage_device_drive_type"), Filesystem = json_extract_scalar(to_json_string(action_file_device_info),"$.storage_device_filesystem"), Drive_Letter = json_extract_scalar(to_json_string(action_file_device_info),"$.storage_device_mount_point"), Device_Serial_Number = json_extract_scalar(to_json_string(action_file_device_info),"$.storage_device_serial_number")
 | filter drive_type = "2"
 | fields action_file_path as File_Path, actor_effective_username as Username, Filesystem, Drive_Letter, Device_Serial_Number
 | filter Device_Serial_Number contains $Serial&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 28 Apr 2025 12:24:16 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/help-with-fine-tuning-a-query-using-arguments-and-enclosing-them/m-p/1227461#M8254</guid>
      <dc:creator>J.Suter</dc:creator>
      <dc:date>2025-04-28T12:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: Help with fine tuning a query using $arguments and enclosing them in "quotes"</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/help-with-fine-tuning-a-query-using-arguments-and-enclosing-them/m-p/1227520#M8255</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/816046735"&gt;@J.Suter&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;​&lt;SPAN class="relative -mx-px my-[-0.2rem] rounded px-px py-[0.2rem] transition-colors duration-100 ease-in-out"&gt;In Cortex XDR's XQL, when using parameters like &lt;CODE data-start="48" data-end="57"&gt;$Serial&lt;/CODE&gt; in your queries, it's essential to ensure that the parameter value is interpreted correctly, especially when dealing with string comparisons.&lt;/SPAN&gt; &lt;SPAN class="relative -mx-px my-[-0.2rem] rounded px-px py-[0.2rem] transition-colors duration-100 ease-in-out"&gt;The issue you're encountering arises because the &lt;CODE data-start="49" data-end="59"&gt;contains&lt;/CODE&gt; operator expects a string value, and if &lt;CODE data-start="100" data-end="109"&gt;$Serial&lt;/CODE&gt; isn't enclosed in quotes, the query may not function as intended.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="relative -mx-px my-[-0.2rem] rounded px-px py-[0.2rem] transition-colors duration-100 ease-in-out"&gt;dataset = xdr_data&lt;BR /&gt;| filter event_type = ENUM.FILE and event_sub_type = ENUM.FILE_CREATE_NEW&lt;BR /&gt;| alter Drive_Type = json_extract(to_json_string(action_file_device_info),"$.storage_device_drive_type"),&lt;BR /&gt;Filesystem = json_extract_scalar(to_json_string(action_file_device_info),"$.storage_device_filesystem"),&lt;BR /&gt;Drive_Letter = json_extract_scalar(to_json_string(action_file_device_info),"$.storage_device_mount_point"),&lt;BR /&gt;Device_Serial_Number = json_extract_scalar(to_json_string(action_file_device_info),"$.storage_device_serial_number")&lt;BR /&gt;| filter drive_type = "2"&lt;BR /&gt;| fields action_file_path as File_Path, actor_effective_username as Username, Filesystem, Drive_Letter, Device_Serial_Number&lt;BR /&gt;| filter Device_Serial_Number contains "$Serial"&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="relative -mx-px my-[-0.2rem] rounded px-px py-[0.2rem] transition-colors duration-100 ease-in-out"&gt;By enclosing &lt;CODE data-start="13" data-end="22"&gt;$Serial&lt;/CODE&gt; in double quotes within the query, you ensure that the parameter is treated as a string, aligning with the expectations of the &lt;CODE data-start="150" data-end="160"&gt;contains&lt;/CODE&gt; operator.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV id="CEG2AE8Q1-1595522554.142700-thread-list-Thread_1610462988.138100" class="c-virtual_list__item" tabindex="-1" role="listitem" aria-setsize="-1" data-qa="virtual-list-item" data-item-key="1610462988.138100"&gt;
&lt;DIV class="c-message_kit__background c-message_kit__background--hovered c-message_kit__message c-message_kit__thread_message" role="presentation" data-qa="message_container" data-qa-unprocessed="false" data-qa-placeholder="false"&gt;
&lt;DIV class="c-message_kit__hover c-message_kit__hover--hovered" role="document" aria-roledescription="message" data-qa-hover="true"&gt;
&lt;DIV class="c-message_kit__actions c-message_kit__actions--above"&gt;
&lt;DIV class="c-message_kit__gutter"&gt;
&lt;DIV class="c-message_kit__gutter__right" role="presentation" data-qa="message_content"&gt;
&lt;DIV class="c-message_kit__blocks c-message_kit__blocks--rich_text"&gt;
&lt;DIV class="c-message__message_blocks c-message__message_blocks--rich_text" data-qa="message-text"&gt;
&lt;DIV class="p-block_kit_renderer" data-qa="block-kit-renderer"&gt;
&lt;DIV class="p-block_kit_renderer__block_wrapper p-block_kit_renderer__block_wrapper--first"&gt;
&lt;DIV class="p-rich_text_block" dir="auto"&gt;
&lt;DIV class="p-rich_text_section"&gt;&lt;SPAN&gt;If you feel this has answered your query, please let us know by clicking like and&amp;nbsp; on "mark this as a Solution". Thank you.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV id="CEG2AE8Q1-1595522554.142700-thread-list-Thread_input" class="c-virtual_list__item" tabindex="-1" role="listitem" aria-setsize="-1" data-qa="virtual-list-item" data-item-key="input"&gt;
&lt;DIV class="p-threads_footer__input_container p-threads_footer__input_container--sticky_composer" data-qa="reply_container"&gt;
&lt;DIV class="p-threads_footer__input p-message_input_unstyled p-message_input_unstyled--attachments-visible p-message_input_unstyled--dark" role="group" aria-label="composer"&gt;
&lt;DIV class="p-message_input__input_container_unstyled c-wysiwyg_container c-wysiwyg_container--theme_dark c-wysiwyg_container--with_footer c-wysiwyg_container--theme_dark_bordered c-basic_container c-basic_container--size_medium" data-max-lines="16"&gt;
&lt;DIV class="c-basic_container__body"&gt;
&lt;DIV class="c-wysiwyg_container__formatting" role="toolbar" aria-orientation="horizontal" aria-label="Formatting" data-qa="wysiwyg-container_formatting-enabled"&gt;
&lt;DIV class="p-texty_sticky_formatting_bar"&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 28 Apr 2025 07:36:40 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/help-with-fine-tuning-a-query-using-arguments-and-enclosing-them/m-p/1227520#M8255</guid>
      <dc:creator>aspatil</dc:creator>
      <dc:date>2025-04-28T07:36:40Z</dc:date>
    </item>
    <item>
      <title>Re: Help with fine tuning a query using $arguments and enclosing them in "quotes"</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/help-with-fine-tuning-a-query-using-arguments-and-enclosing-them/m-p/1227554#M8266</link>
      <description>&lt;P&gt;This command does not execute with the argument/parameters window and searches for "$serial" as typed, this happens while using&amp;nbsp;&lt;STRONG&gt;contains&lt;/STRONG&gt; or &lt;STRONG&gt;=&lt;/STRONG&gt; in the line (&lt;EM&gt;see images&lt;/EM&gt;). By enclosing $serial in quotes, it removes the ability to put in an argument/parameters. I was hoping there was a way to redefine the JSON parameter to remove the need of quotes or add them in while still using $serial for input of data. I just don't know how to do it.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Update:&lt;/STRONG&gt; This only Happens when the serial is all numbers EG: 23456 Will not have quotes while 234S6 will have quotes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Update Solution:&lt;/STRONG&gt; changing the last line to string resolved the issue &lt;EM&gt;&lt;STRONG&gt;| filter Device_Serial_Number contains to_string($Serial)&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;dataset = xdr_data
 | filter event_type = ENUM.FILE and event_sub_type = ENUM.FILE_CREATE_NEW
 | alter Drive_Type = json_extract(to_json_string(action_file_device_info),"$.storage_device_drive_type"), Filesystem = json_extract_scalar(to_json_string(action_file_device_info),"$.storage_device_filesystem"), Drive_Letter = json_extract_scalar(to_json_string(action_file_device_info),"$.storage_device_mount_point"), Device_Serial_Number = json_extract_scalar(to_json_string(action_file_device_info),"$.storage_device_serial_number")
 | filter drive_type = "2"
 | fields action_file_path as File_Path, actor_effective_username as Username, Filesystem, Drive_Letter, Device_Serial_Number
 | filter Device_Serial_Number contains to_string($Serial) &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Apr 2025 13:02:28 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/help-with-fine-tuning-a-query-using-arguments-and-enclosing-them/m-p/1227554#M8266</guid>
      <dc:creator>J.Suter</dc:creator>
      <dc:date>2025-04-28T13:02:28Z</dc:date>
    </item>
  </channel>
</rss>

