Jump to content
  • 0

Table field Formula help


Mirko

Question

 

I want to use a case formula where the Date field contains the same info them 1 else 0. 

I trued this one, but it does not work as expected. 

Case 
WHEN ([@field:Data]) = ([@field:Data]) THEN '1' 
ELSE
'0'
END

Date column contains:  dd/mm/year/ hours:minutes:seconds:  The above formula just match for  dd/mm/year/ and it does not consider time hours:minutes:seconds ( I would expected to have 1,1,0,0,0,0,0)

How can I solve please? 

image.png.a23488dd8f9897b062009d80968344c3.png

 

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Hi there!

If the goal is to check the 2 date fields if they are matched it displays 1 and 0 if not. You can try to check this code: 


Case 
WHEN CONVERT(varchar,[@field:XXXX],106) =CONVERT(varchar,[@field:XXXX],106) THEN '1' 
ELSE
'0'
END

Just change the field names and table names depending on the field that you are using.

I hope this is useful. 

Link to comment
Share on other sites

  • 0

If you want to check if day, month and year matches you may use the formula below and change the Date field.
 

CASE
    WHEN MONTH([@field:Date]) = MONTH([@field:Date2]) AND YEAR([@field:Date]) = YEAR([@field:Date2]) AND DAY([@field:Date]) = DAY([@field:Date2]) THEN '1 1 1'
    WHEN YEAR([@field:Date]) = YEAR([@field:Date2]) THEN '0 0 1'
    WHEN MONTH([@field:Date]) = MONTH([@field:Date2]) THEN '0 1 0'
    ELSE '0 0 0'
END



In this formula follows dd/mm/yyyy format and it checks if it matches day, month, and year.

So if datefield1 and datefield two only matches month it would return '0 1 0'

Hope this helps!

Link to comment
Share on other sites

  • 0

Hello!

It seems that your formula is working even if the goal only is to check the 2 date fields if they are matched (1) or not (0). Perhaps could you please elaborate more on the expected which is to have 1,1,0,0,0,0,0? You may refer to Function Reference for other functions that you can use in the formula: 

https://howto.caspio.com/function-reference/

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...