Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 5889 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I've got a table that has records of stays by individuals at a homeless shelter. Each record has value for an admit date and may or may not have a value for the departure date (if the person hasn't left yet).

I've also got two globals that feed a report. I'm trying to calculate the total number of nights during the two dates in the globals.

Here's the calc:

Let([

today = Get(CurrentDate);

startReport = Report Globals::Start Date;

endReport = Report Globals::End Date;

admit = Individual Admittance::Individual Admission date;

depart = Individual Admittance::Individual Departure Date;

depart = Case(IsEmpty(depart); today; depart);

end = Min(endReport;depart);

start = Max(startReport; admit);

result = end - start

];

result

)

This gives me expected results for records with a depart date. But with no depart date, I'm getting very odd results. I get the correct answer half the time...literally. As an unstored calc, and in the Data Viewer, the result toggles between the correct number of days (end - start) and a different number (admit - start).

It's pretty weird. The results toggle on some records when I click in and out of the record.

I copy and pasted the two tables into a new file and imported the data with similar results, it seems a less common (10% of the time rather than 90%), but still there.

Any thoughts?

Posted

How about a demo showing the problem? I cannot see anything obviously wrong with the calc, but I don't see your relationships, and I'd suspect them first (why aren't admit/depart local fields to begin with?).

Posted

They two date fields are local, they're just presented with relationships in order to debug.

After opening it this morning, the unstored calc as a field seemed to be working ok, but not the exact same calc in the debugger. Then I closed and restarted again and everything's fine.

I'm in the Twilight Zone.

If I can get the file to replicate the behavior consistently, I'll definitely post it.

This topic is 5889 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.