# PropertyReference failed to read value

**URL:** <https://forum.inductiveautomation.com/t/propertyreference-failed-to-read-value/60440>\
**Category:** Ignition\
**Tags:** python, ignition80, perspective, scripting, database\
**Created:** [June 7, 2022, 9:46am UTC](https://forum.inductiveautomation.com/t/propertyreference-failed-to-read-value/60440 "2022-06-07T09:46:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![IA\_old\_forum](https://avatars.discourse-cdn.com/v4/letter/i/7ab992/32.png) [@IA\_old\_forum](https://forum.inductiveautomation.com/u/IA_old_forum)\
**Post date:** [June 7, 2022, 9:46am UTC](https://forum.inductiveautomation.com/t/propertyreference-failed-to-read-value/60440/1 "2022-06-07T09:46:29Z")

</div>

Hello! I have some issues with historical tag readings.

We work with 3 shifts daily. From 06:00 to 14:00, from 14:00 to 22:00 and from 22:00 to 06:00; I have to make a perspective page to show the faults count and as a percentage of the overall cycles (B. in the picture below), for every 8 hour shift previous, limited to 20 shifts before.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/0/40724d40f38b8abbca4dd60abaa730a95f88bdd7.png)

For that I make a table with a history tag binding for all the fault counters (tags) and have the following for historic dates:

```auto
Start Date = dateArithmetic({view.custom.date},-(480*{../shifts_back.custom.value}),"minutes")
End Date = dateArithmetic({view.custom.date},-(480*{../shifts_back.custom.value}),"minutes")

```

In my view I have a custom property that will select the current shift start date:

```auto
if (getHour24(now())>= 6 && getHour24(now())< 14, dateFormat(now(),'yyyy-MM-dd 06:00:00'),
 	
 		if(getHour24(now())>= 14 && getHour24(now())< 22, dateFormat(now(),'yyyy-MM-dd 14:00:00') ,
 		
 		if(getHour24(now())>= 22 && getHour24(now())< 23, dateFormat(now(),'yyyy-MM-dd 22:00:00'),		
 		
 
 		dateArithmetic(midnight(now()),-2,'hours') 
 )))

```

The buttons are to move back and forth between previous shifts and change the number of the property for number of shift (0-20), so depending on the amount of shifts the user wants to go back, the:

```auto
dateArithmetic({view.custom.date},-(480*{../shifts_back.custom.value}),"minutes")

```

should return the desired date (I use it for both start date and end date).

It was working until the last 6 shifts, now I get a log warning that says PropertyReference failed to read value, for A. and B. (in the Picture above) and same for the table

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/8/e8625b227f135209cb55a70f7f9b3c4490a71287.png)

Does anyone know what the problem might be? Should I come up with another way to set the start and end dates? I only want the last value before the end of the shift that is to be looked at

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [June 7, 2022, 10:29am UTC](https://forum.inductiveautomation.com/t/propertyreference-failed-to-read-value/60440/2 "2022-06-07T10:29:09Z")

</div>

> [@Mariano\_Alvarez](#):
>
> ```auto
> Start Date = dateArithmetic({view.custom.date}, -(480 * {../shifts_back.custom.value}), "minutes")
> End Date = dateArithmetic({view.custom.date}, -(480 * {../shifts_back.custom.value}), "minutes")
> 
> ```

First problem: Start and End are identical! Is that fixed elsewhere?

---

<div class="post-metadata">

**Author:** ![IA\_old\_forum](https://avatars.discourse-cdn.com/v4/letter/i/7ab992/32.png) [@IA\_old\_forum](https://forum.inductiveautomation.com/u/IA_old_forum)\
**Post date:** [June 7, 2022, 10:32am UTC](https://forum.inductiveautomation.com/t/propertyreference-failed-to-read-value/60440/3 "2022-06-07T10:32:07Z")

</div>

But it was working before. Even if I put a start date 2-3 days before it shows 0 or gives the error

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [June 7, 2022, 10:57am UTC](https://forum.inductiveautomation.com/t/propertyreference-failed-to-read-value/60440/4 "2022-06-07T10:57:34Z")

</div>

You must have changed something.

A couple of observations:

```auto
if (getHour24(now()) >= 6 && getHour24(now()) < 14, 
        dateFormat(now(), 'yyyy-MM-dd 06:00:00'),
    if(getHour24(now()) >= 14 && getHour24(now())< 22, 
       dateFormat(now(),'yyyy-MM-dd 14:00:00'),
        if(getHour24(now()) >= 22 && getHour24(now()) < 23,
            dateFormat(now(),'yyyy-MM-dd 22:00:00'),		
         	dateArithmetic(midnight(now()),-2,'hours') 
 )))

```

I don’t think you should need to format as a string. If the values are passed back as datetime type Ignition should handle it properly. That would allow you to use:

```auto
if (getHour24(now()) >= 6 && getHour24(now()) < 14,     
    addHours(midnight(now(), 6),
    if(getHour24(now()) >= 14 && getHour24(now())< 22, 
        addHours(midnight(now(), 14),
        if(getHour24(now()) >= 22,
            addHours(midnight(now(), 22),
        	addHours(midnight(now()), -2) 
 )))

```

The other comment is that green seems a strange choice to show the number of faults. It generally signals that things are going well. I encourage you to use [Perspective Built-In Themes - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/Perspective+Built-In+Themes#PerspectiveBuiltInThemes-Built-inThemeColors) and have a look at some good GUI / HMI guides. Use color sparingly, consistently and always with a purpose.

---

<div class="post-metadata">

**Author:** ![IA\_old\_forum](https://avatars.discourse-cdn.com/v4/letter/i/7ab992/32.png) [@IA\_old\_forum](https://forum.inductiveautomation.com/u/IA_old_forum)\
**Post date:** [June 7, 2022, 12:58pm UTC](https://forum.inductiveautomation.com/t/propertyreference-failed-to-read-value/60440/5 "2022-06-07T12:58:56Z")

</div>

Though the date string works, I changed to your recommendation for better practice! 🙂  
I played a bit with the historian parameters and it is sort of working again, but I decided to change to a transaction group with the shift schedule and use queries to bring the data up.

Regarding the other comment, as long as they are under 1%, they should be displayed green. However when they should appear red... I did not know how to change the style of the bar chart. I will give that documentation a look, I bet it will help.

Thank you very much for the input anyway!

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [June 7, 2022, 1:26pm UTC](https://forum.inductiveautomation.com/t/propertyreference-failed-to-read-value/60440/6 "2022-06-07T13:26:22Z")

</div>

Actually, if I remember correctly the chart components don’t understand the Ignition theme variables. Keep doing what you’re doing for the charts.
