Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
minLevel1
maxLevel2
typeflat

Overview

If you are familiar with LINQ scripting, the free-text query of the data search area can be a convenient option to query data. Using this option, you can access a data table and build your query directly, without using the search window tools.

...

What permissions do I need?

To run a LINQ query using the free text of the Data search → Explore your data → Free text query area you need to have the manage level of the Free text queries permission, otherwise you will not see the tab in this area. Take into account that you need to activate any level of the parent permission (Finders)to enable the permission checkbox (know more about permissions here).

...

Running the LINQ free-text query

If you are familiar with LINQ scripting, the free-text query can be a convenient option to query data. Using this option, you can access a data table and build your query directly, without using the search window tools.

Rw ui steps macro
Rw step

Go to Data search → Explore your data, then open the Free text query tab. 

Rw step

Click the time range box at the right area to open the calendar and select the time period over which you want to search (see the section below for more info).

Rw step

Enter your LINQ query . Click (more info inBuild a query using LINQ).

Rw step

Once you write the tags corresponding to a data table, you can click on Show table fields next to the time range calendar to get a summary of the available fields for your querythat data table. Close this window by clicking on the X tab.

Image Removed

To learn more about the LINQ syntax and how to build a query using this language, go toBuild a query using LINQ.

Rw step

The Select all fields option is checked by default. This will show all the fields of the table no matter the ones you use in your query. Uncheck this option if you only want to see the fields specified in your query when you access the search.

Visit the dedicated article to know more about showing specific fields.

Image Added
Rw step

Click Run when you are ready or use the shortcut keys CTRL+Enter in PC and CMD+Enter in Mac (hover over the Run button to see the shortcuts).

If there are syntax errors, you will be alerted to make corrections. Otherwise, the data table will open to display the results of your query.

Info

LINQ examples

Some LINQ examples are displayed in the Help area on the right side of the window. Click the question mark icon to open this up.

...

Rw ui tabs macro
Rw tab
titleUsing the interface

You can set a time interval following the steps described in the picture below.

Rw tab
titleUsing date language expressions

You can also introduce time ranges manually using date language expressions, which gives you more flexibility and precision when searching your data. Simply click on the date field and write the desired time expression or edit the existing one. The field turns red and an explanatory message appears until a valid date is entered. Click Apply when you finish. When the and the expressions will be translated into the corresponding dates.

Note

Your from date cannot be after your to date and your to date cannot be in the future.

You can use a mix of both absolute and date language expressions in any given time range (for example, the to date can be relative and the from date absolute, and vice versa). For date language expressions, the current moment "now()" is used as the reference point.

Operators

You can establish absolute dates in the required format:

Operator

Action

Example

yyyy-MM-dd hh:mm:ss

Establishes the specified absolute date

2021-06-30 15:35:23

With date language expressions, use a series of mathematical operations to move away from the current time which is used as the reference point. You can use multiple operators at once and the execution order is from left to right:

Operator

Action

Example

Snap to (@) or |<

Rounds the date to the beginning of a time unit. Note that this operator only works with 1m, 1d, 1h, 1w, 1W, 1M and 1y.

now() @ 1m or now() |< 1m

Arithmetics (+/-)

Applies an offset to the date (date + offset or date - offset)

now() - 3h

Replace (^)

Replaces part of the date by a time unit (date ^ time_unit)

now() ^ 6d

Backward & forward (>>/<<)

Shifts the date to the next/past time unit (date >> time_unit or date << time_unit)

now() << 11M

Time Expressions

Let's suppose the current time (which we refer to as "now()") is Sunday, 05 February 2017, 13:37:05. The table below shows the resulting time when different expressions are applied. Note that this isn't an exhaustive list:

Time expression

Description

Resulting time

now() - 60m

60 minutes ago

Sunday, 05 February 2017, 12:37:05

now() @ 1h

Now (rounded to the beginning of the hour)

Sunday, 05 February 2017, 13:00:00

now() - 24h

24 hours ago

Saturday, 04 February 2017, 13:37:05

(now() - 1d) @ 1d

Yesterday (rounded to the beginning of the day)

Saturday, 04 February 2017, 00:00:00

(now() - 2d) @ 1d

2 days ago (rounded to the beginning of the day)

Friday, 03 February 2017, 00:00:00

(now() - 2d) @ 1m

2 days ago (rounded to the beginning of the minute)

Friday, 03 February 2017, 13:37:00

((now() - 2d) @ 1d) - 2h

2 days ago (rounded to the beginning of the day minus 2 hours)

Thursday, 02 February 2017, 22:00:00

now() @ 1w

Locale week

Sunday, 05 February 2017, 00:00:00

now() @ 1W

ISO week

Monday30 January 2017, 00:00:00

now() ^ 6d

Replace the day with 6

Monday, 06 February 2017, 13:37:05

now() ^ 2018y3M6d15h30m20s

Replaces the year with 2018
Replaces the month with 3
Replaces the day with 6
Replaces the hour with 15
Replaces the minutes with 30
Replaces the seconds with 20

Tuesday, 06 March 2018, 15:30:20

now() >> 2M

Forward to next second month

Monday, 05 February 2018, 13:37:05

now() << 2M

Backward to previous second month

Friday, 05 February 2016, 13:37:05

now() >> 2M6d15h20m10s

Forward to next second month, sixth day, fifteenth hour, twentieth minute and 10 seconds

Tuesday, 06 February 2018, 15:20:10

now() << 1h/1d

Goes back to the first hour of the current day. Minutes and seconds don't change.

Sunday, 05 February 2017, 01:37:05

...

Rw ui steps macro
Rw step

After opening a data table, you can find the query code editor at the top right area of the window.

If it is not there, select the Query code editor button in the search window toolbar to display it.

Rw step

Write or edit your query in the editor. If you need to check the available fields on the table, click on Show table fields and the list will appear on the right.

Image Removed
Rw step

Click Run to retrieve the results of the query. If you are not familiar with LINQ you can learn how to query using this language in Build a query using LINQ.

Image Added
Rw step

Click Run to retrieve the results of the query.