INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Math() expression not working  (Read 2354 times)

Cmely

  • Junior Woodchuck
  • **
  • Posts: 78
Math() expression not working
« on: January 07, 2017, 08:49:37 am »

This is a duplicate of my post in MC21 board, because my problem appear in MC22

I have a problem on my MC with this expression:

Code: [Select]
formatdate(math(now()-1),dd//MM//yyyy)
is not working for me and I don't know why ?
If I use this to create an expression column in a view, I get no result (empty field). If I use the following expression :

Code: [Select]
=formatdate(now())
I get the correct result. Do you have any idea why ?

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014
Re: Math() expression not working
« Reply #1 on: January 07, 2017, 09:16:46 am »

I cut and pasted your expression into an expression column in a Panes view and it worked fine here.  MC 22.0.43 on Mac.

Brian.
Logged

Cmely

  • Junior Woodchuck
  • **
  • Posts: 78
Re: Math() expression not working
« Reply #2 on: January 07, 2017, 09:28:08 am »

I cut and pasted your expression into an expression column in a Panes view and it worked fine here.  MC 22.0.43 on Mac.

Brian.

Yes. I'm sure it did, as I just copied also the expression as given by Marko, in his thread about "when in time" expression.
I'm running MC 22.0.52 on PC Win10.

I can't figure why it doesn't work. You can see the result on my screen capture below.
Could it be a conflict between date format in MC (which is in english on my PC) and my system configuration (which is in french) ?

fridden

  • Recent member
  • *
  • Posts: 31
Re: Math() expression not working
« Reply #3 on: January 07, 2017, 02:37:54 pm »

Check out the documentation for Math() at
http://wiki.jriver.com/index.php/Miscellaneous_Functions#Math

Special care must be taken with the Math() function and locales that use , (comma) as a decimal separator. Many Media Center fields and the return values from functions may contain comma as the decimal point. Your expressions will need to Replace() these before passing the values to Math(), which always uses dot . as the numeric decimal point.

You need to write the expression like this:
=FormatDate(math(replace(now(), /,, .) -1),dd//MM//yy)
Logged

Cmely

  • Junior Woodchuck
  • **
  • Posts: 78
Re: Math() expression not working
« Reply #4 on: January 08, 2017, 02:53:18 am »

Thank you Fridden !!!!  :D
You solved my problem !
Pages: [1]   Go Up