# Perspective Expression error scan illegal comma character

**URL:** <https://forum.inductiveautomation.com/t/perspective-expression-error-scan-illegal-comma-character/46107>\
**Category:** Ignition\
**Created:** [April 28, 2021, 1:00pm UTC](https://forum.inductiveautomation.com/t/perspective-expression-error-scan-illegal-comma-character/46107 "2021-04-28T13:00:04Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![zacharyw.larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zacharyw.larson/32/23749_2.png) [@zacharyw.larson](https://forum.inductiveautomation.com/u/zacharyw.larson)\
**Post date:** [April 28, 2021, 1:00pm UTC](https://forum.inductiveautomation.com/t/perspective-expression-error-scan-illegal-comma-character/46107/1 "2021-04-28T13:00:04Z")

</div>

system.date.daysBetween(first, second) throwing an error

instead of first and second, I am using the tag paths  
I am doing the expression in a label binding for the text in perspective

I don’t understand why this comma is throwing an error

I just want the difference in these two dates in minutes

A sepasoft module is producing the dates

I use the transform function usually to read them out as minutes short.

if I don’t use a transform, then 2021-4-28 8:34:31.000Z is read out

if I pick the transform minutes and short, I get like 8:24 AM

So I think my dates are coming out as good data.

Still, this comma error is concerning though, and I can’t seem to get the difference in minutes yet

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [April 28, 2021, 1:05pm UTC](https://forum.inductiveautomation.com/t/perspective-expression-error-scan-illegal-comma-character/46107/2 "2021-04-28T13:05:26Z")

</div>

`system.date.daysBetween()` is part of the jython scripting language. It is not a valid expression.

Are you truly using an expression, or is this a script? If it is a script, seeing the full script as well as the error would be very helpful.

If it is an expression then try the [dateDiff](https://docs.inductiveautomation.com/display/DOC81/dateDiff) expression function.

```auto
dateDiff(first,second,'min')

```

---

<div class="post-metadata">

**Author:** ![zacharyw.larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zacharyw.larson/32/23749_2.png) [@zacharyw.larson](https://forum.inductiveautomation.com/u/zacharyw.larson)\
**Post date:** [April 28, 2021, 1:09pm UTC](https://forum.inductiveautomation.com/t/perspective-expression-error-scan-illegal-comma-character/46107/3 "2021-04-28T13:09:27Z")

</div>

when I typed the initial post, I made an error  
was using system.date.minutesBetween()

I have a label on perspective.  
I click the bind for the text.  
I pick expression.  
I put in line 1 first= tag  
line2 second = other tag  
dateDiff(first,second,"min’)

error is error\_configuration  
Error\_configuration ("Runtimeexceptions:syntax error on token:‘EQUAL’(line 1 character 6

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [April 28, 2021, 1:16pm UTC](https://forum.inductiveautomation.com/t/perspective-expression-error-scan-illegal-comma-character/46107/4 "2021-04-28T13:16:22Z")

</div>

You’re mixing scripting with the expression language.

Instead, insert the paths to the tags. and just use the expression

```auto
dateDiff({'path to first date'},{'path to second date'},'min')

```

---

<div class="post-metadata">

**Author:** ![zacharyw.larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zacharyw.larson/32/23749_2.png) [@zacharyw.larson](https://forum.inductiveautomation.com/u/zacharyw.larson)\
**Post date:** [April 28, 2021, 1:17pm UTC](https://forum.inductiveautomation.com/t/perspective-expression-error-scan-illegal-comma-character/46107/5 "2021-04-28T13:17:03Z")

</div>

ah when I use dateDiff(tag,othertag,‘min’) it works  
I was mixing script stuff with expression stuff on accident

silly me

however now, it is reading like 4 decimals, and I just want the integer followed by the word minutes, aligned right if possible.

I did a transform to get the integer, but I was hoping I could also apply the “Minutes” as a string in that same label.

Oh I added an expression to the end and got it

was like {value}+" Minutes"

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [April 28, 2021, 1:21pm UTC](https://forum.inductiveautomation.com/t/perspective-expression-error-scan-illegal-comma-character/46107/6 "2021-04-28T13:21:03Z")

</div>

use toInt to convert to an integer.

```auto
concat(toStr(toInt(dateDiff({'path to first date'},{'path to second date'},'min')),'Minutes')

```

you’ll have to take care of the formatting with the component style.

You can find all of the expression functions here in the manual.  
[https://docs.inductiveautomation.com/display/DOC81/Expression+Functions](https://docs.inductiveautomation.com/display/DOC81/Expression+Functions)

---

<div class="post-metadata">

**Author:** ![zacharyw.larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zacharyw.larson/32/23749_2.png) [@zacharyw.larson](https://forum.inductiveautomation.com/u/zacharyw.larson)\
**Post date:** [April 28, 2021, 1:22pm UTC](https://forum.inductiveautomation.com/t/perspective-expression-error-scan-illegal-comma-character/46107/7 "2021-04-28T13:22:29Z")

</div>

![Capture](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/b/8b09ba6f54407911551ae4b9a3202c643069b17e.png)

Thanks for all your help again!

It looks great

---

<div class="post-metadata">

**Author:** ![zacharyw.larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zacharyw.larson/32/23749_2.png) [@zacharyw.larson](https://forum.inductiveautomation.com/u/zacharyw.larson)\
**Post date:** [April 28, 2021, 1:28pm UTC](https://forum.inductiveautomation.com/t/perspective-expression-error-scan-illegal-comma-character/46107/8 "2021-04-28T13:28:10Z")

</div>

I can’t help wondering if I am hindering myself doing it this way instead of with a tag.

I have like 30 of these to place on the page.  
I think I have to make each one manually.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [April 28, 2021, 1:36pm UTC](https://forum.inductiveautomation.com/t/perspective-expression-error-scan-illegal-comma-character/46107/9 "2021-04-28T13:36:33Z")

</div>

I’m not sure.

A single expression transform on 30 components, I wouldn’t consider a lot, but then I don’t know what else is going on in the application.

6 one way, half a dozen another. It’s really up to you to decide what works best for you, is the most understandable for the future you (or developer), and gets you the quickest most accurate results.

---

<div class="post-metadata">

**Author:** ![zacharyw.larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zacharyw.larson/32/23749_2.png) [@zacharyw.larson](https://forum.inductiveautomation.com/u/zacharyw.larson)\
**Post date:** [April 28, 2021, 1:43pm UTC](https://forum.inductiveautomation.com/t/perspective-expression-error-scan-illegal-comma-character/46107/10 "2021-04-28T13:43:20Z")

</div>

Thanks, you are right for sure

copy, paste the labels, replace the tag path of the dates used is the fastest

I would have to make new tags, copy folders, copy new labels the other way

---

<div class="post-metadata">

**Author:** ![zacharyw.larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zacharyw.larson/32/23749_2.png) [@zacharyw.larson](https://forum.inductiveautomation.com/u/zacharyw.larson)\
**Post date:** [April 28, 2021, 1:45pm UTC](https://forum.inductiveautomation.com/t/perspective-expression-error-scan-illegal-comma-character/46107/11 "2021-04-28T13:45:08Z")

</div>

I just have one lingering question for this

Did System.date.minutesBetween() fail because that is not an expression?  
What is that?

I don’t understand why that fails and dateDiff() works

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [April 28, 2021, 1:48pm UTC](https://forum.inductiveautomation.com/t/perspective-expression-error-scan-illegal-comma-character/46107/12 "2021-04-28T13:48:56Z")

</div>

`system.date.minutesBetween()` is a scripting function.

Basically, if you ever have `'.'` notation you’re using scripting.

---

<div class="post-metadata">

**Author:** ![zacharyw.larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zacharyw.larson/32/23749_2.png) [@zacharyw.larson](https://forum.inductiveautomation.com/u/zacharyw.larson)\
**Post date:** [April 30, 2021, 8:51pm UTC](https://forum.inductiveautomation.com/t/perspective-expression-error-scan-illegal-comma-character/46107/13 "2021-04-30T20:51:12Z")

</div>

So now I am trying to make the tag invisible when over 1000 minutes.

I will have to come back to it Monday.

* * *

Monday I realized that the value was the expression without the transforms.  
Was really silly to not realize on the end of that day 7 days past.

Thanks for all the help  
I timed a person finding the information displayed on the page, and it was less than 2 seconds first time, only faster after.
