Skip to main content

🆘 Complicated formula help please

  • October 1, 2020
  • 29 replies
  • 169 views

Show first post
This topic has been closed for replies.

29 replies

Forum|alt.badge.img+14
  • Author
  • Inspiring
  • October 7, 2020

Ok, I just found a little hiccup in the code and am having a tough time finding a solution.

For my “sameShiftRecordsexact” it is pulling in data if the chosen shift is within another shift and not just exactly the same.

I thought this part

    ((triggerValues.start <= x.start && triggerValues.stop >= x.stop)) && 

would just need

==

instead of

<=

but that didn’t work :frowning: Any help is greatly appreciated :slightly_smiling_face:


Kamille_Parks11
Forum|alt.badge.img+27

Ok, I just found a little hiccup in the code and am having a tough time finding a solution.

For my “sameShiftRecordsexact” it is pulling in data if the chosen shift is within another shift and not just exactly the same.

I thought this part

    ((triggerValues.start <= x.start && triggerValues.stop >= x.stop)) && 

would just need

==

instead of

<=

but that didn’t work :frowning: Any help is greatly appreciated :slightly_smiling_face:


Did you set both <= and >= to ==?


Forum|alt.badge.img+14
  • Author
  • Inspiring
  • October 7, 2020

Did you set both <= and >= to ==?


Yeah, when I change them both to == it is not recognizing anything for the “sameShiftRecordsExact”.

((triggerValues.start == x.start && triggerValues.stop == x.stop)) &&


Forum|alt.badge.img+14
  • Author
  • Inspiring
  • October 7, 2020

Yeah, when I change them both to == it is not recognizing anything for the “sameShiftRecordsExact”.

((triggerValues.start == x.start && triggerValues.stop == x.stop)) &&


Disregard. I finally figured it out :slightly_smiling_face: Had to change this block of code to with the “toISOString”

Thanks again.

const sameShiftRecordsExact = shiftRecords.filter(x => {

return (x.start.toISOString() == triggerValues.start.toISOString()&&

    (x.stop.toISOString() == triggerValues.stop.toISOString()&&

    (x.location == triggerValues.location))

)

})