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

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

Recommended Posts

Posted

I have a similar problem to the recent threads on filtering information in a portal.

I have an 'invoices' table that contains a portal showing 'extras' that are in a related table ("Extras ID = Invoices ID") but different (remote) fm8.5 file. All the 'extras items' show up as expected in the portal. However, I need the portal to show only the unpaid 'extras items' for each client. Using a 'date received' field in the 'extras' table, I have set up a global calculation field ( 'gfilter') as follows:

Global,= isEmpty (extras: Date_received)

My question is:

How should I proceed from here? Because 'invoices' and 'extras' are in different files, will a global field actually work, and if not, how can I get round this?

Grateful thanks in advance for any suggestions - this has had me puzzled for a while now.

Posted

Hi Angus Murray,

I would not recommend joining ExtraID to InvoiceID. I assume that might be a mistake but you should have an InvoiceID in your Extras table (as the foreign key) and join Invoices::InvoiceID to Extras::InvoiceID.

But to your question (assuming you have an InvoiceID in extras):)

Create another occurrence of your Extras table (maybe called unpaid Extras) and establish the relationship as:

Invoices::InvoiceID = UnpaidExtras::InvoiceID

AND

Invoices::InvoiceID > UnpaidExtras::DatePaid

In this way, each unpaid Extras portal (on an Invoice or Client layout) will only display those Extra items who do NOT have a date paid in them and no global in Invoices is needed. :wink2:

UPDATE: I'm unclear whether these unpaid extras should show up in your Client layout or your Invoices layout. Adjust as needed.

LaRetta

Posted

Ah. It can break. Extreme example - InvoiceID 8999999 and date 1/1/0001.

But worse than that ... when I add a calculation cConstantOne with simple number 1 and use it in place of the InvoiceID in > date, it doesn't display ANY records. In other words, using the InvoiceID, InvoiceID 1 works and constant 1 BREAKS. (please see attached). Note that InvoiceID 1 displays unpaid records. Then change the relationship to using the constant 1. It breaks entirely.

It was poor logic of mine ... thinking that ANY invoice number would be greater than an empty date field; and not considering that a very large invoice number could still be greater than a current date (number).

What throws me now is that InvoiceID 1's unpaid entry will disappear when I change the line to using the constant one instead of the InvoiceID - both are numbers. :confused:

LaRetta

invoiceextras.zip

Posted

a very large invoice number could still be greater than a current date (number).

That's what occurred to me first. But then I tried and couldn't get it to work at all (using a plain number field opposite a date field). I can't see any apparent logic in this. It certainly breaks Shawn's assumption that the 'local' matchfield value is converted to the type of the 'remote' matchfield. The only conclusion I can draw is that experimenting with mis-matched field types is risky. I would go for a conservative solution: a calculation field in Extras =

Case ( not DatePaid ; InvoiceID )

and match that (alone) with the InvoiceID in Invoices.

Posted (edited)

Well, to provide a consistent always-working solution, create a calculation called cUnpaidExtra in your Extras table. It would be simply:

Case ( not DatePaid ; InvoiceID )

Then the relationship would be:

Invoices::InvoiceID = cUnpaidExtra

This is assuming your DatePaid is a true date. If not, it should be. I've used comparative relationships before, joining to empty fields. But it won't work here because we (as Comment questions) are joining number to number.

I'm still questioning why my demo works in apparently inconsistent fashion.

UPDATE: I was busy typing my response and didn't see your post. Yes, I assumed it worked because dates are numbers anyway to FM. But do you see the problem in my demo file on why it breaks with constant but not with the ID?

LaRetta

Edited by Guest
Posted

All I have is an unsupported wild guess: with the ID field, it already has an index, created to deal with a number on the opposite side. But if there's no index yet, and the opposite field is a date, it goes crazy.

FWIW, if you type a date into the number field, it will find a matching date - seems it matches text to text.

Posted

You are welcome but ...

I would have never got there without your post!

... and we wouldn't have gotten there without Comment questioning my original suggestion.

Thank you, Michael. :smile2:

This topic is 6320 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.