About EasyMorph Tutorials & Examples Web-help

Incomparable values for condition by dates


#1

Hi All,

please help me to understand what is the reason of issue. I have very simple task - to read the text file with huge count of lines and cut it by condition of dates, in other words i want to select all lines from the file and keep only that is more than yesterday.

For this reason it was created the parametr {DATE} = format(today()-1,‘dd.MM.yyyy’). There is only 2 steps in the project:

  • read the file
  • filter by condition “[Sell-In End Date] > {DATE}”

In the result i have the error message Condition must evaluate to either TRUE or FALSE. However in row #1 it’s: #Incomparable values for ‘>’.

During the attempt to change the conditions the count of errors is change, that more strange for me. And fyi - it was working project before this issue.

What is wrong ?

The using file in attached.EasyMorph_issue.morph (5.8 KB)
issue_file.zip (1.4 MB)

Thanks in advance


#2

Hi Irina,

the filtering doesn’t work because your expression compares two text values, instead of number dates. The > operator (“greater than”) can’t be applied to text values, only to numbers. Note that dates in EasyMorph are numbers, exactly as in Excel. See this tutorial article for more explanation on dates in EasyMorph: http://easymorph.com/learn/expressions.html

You can see that the values in columns [Sell-in Start Date] and [Sell-in End Date] are text because they are left aligned. By comparison columns [Serial No] and [Week ID] contain numbers, because values are aligned to the right.

image

Alternatively, you can also right-click a cell and view its type in the metadata window.

image

In order for the filtering expression to work correctly, text dates should be converted to number dates first. This can be done by either using the date() function, or Convert Data Types transformation (see the example below).

The expression for calculating the {DATE} parameter should be just

today()-1

without using format() because it converts the result to text and makes it incomparable with number dates.

EasyMorph_issue.morph (2.2 KB)

To format numbers as dates use the formatting options in the sidebar when a column is selected.


#3

Hi Dmitry,

thanks for quick response. all converting was used via different steps and now i understood my issue was set in the formula of parameter.

Sincerely, Irina!