Date variable to search database

I’m using table filters to search my data. I would like to search by date. Is it possible to have the filter variable show the same flexibility of date interpretation as the panorama database search? (In other words, if I type in 9/7, for it to be recognised as 09/07/2025, rather than needing to exactly match that format for it to work?

This is what I have currently - it requires an exact format match:
((«selectSearch» = “”) or («Check» contains «selectSearch»)) and ((«paddockSearch» = “”) or («Paddock») contains «paddockSearch») and ((«propertySearch» = “”) or («Property») contains «propertySearch») and ((«fateSearch» = “”) or (exportcell(«Fate») contains «fateSearch»)) and ((«idSearch» = “”) or (exportcell(«TotalID») contains «idSearch») or (exportcell(«Unique») contains «idSearch»)) and ((«sellSearch» = “”) or («Sell» contains «sellSearch»)) and ((«whpSearch» = “”) or («WHP»)>today() or («ESI»)>today()) and ((«dateSearch» = “”) or (exportcell(«DateSeen») contains «dateSearch»))

If you change

or (exportcell(«DateSeen») contains «dateSearch»))

to

or («DateSeen» = date(«dateSearch»)))

I think you will get that result. I’m assuming that DateSeen is a date field.

Note. When you leave off the year, Panorama assumes the date is between 9 months in the past and 3 months in the future, so 10/7 would be seen as 10/07/2024. Today’s date is in July, so any date without a year will be seen to lie between 10/01/2024 and 9/30/2025 inclusive.

Mdunlop, this isn’t specific to your question - which Dave answered - but consider “unpacking” that “… and … or …” structure a bit.

I could be wrong of course, but I think, in the future, especially if there are criteria changes (and there are always changes), it will be easier to understand what your Selects are asking for, and to make modifications in one area without introducing an error somewhere else.

There’s an elegance to achieving something with minimum statements/commands. But it can be carried too far.

There is more elegance in structuring code and variables so you could hand it to someone “on the street” and they can quickly understand what was happening and where to put the desired change.

I haven’t looked at your structure in depth, but it appears you could do a select on your first criteria, then follow that with a SelectAdditional statements for the other fields. Separate each of those SelectAdditional segments by a blank line and bracket the whole thing with a line like ***************** above and below. And above the top ************* put a comment describing the purpose/goal of that group of Selects.

Six months from now, when you need to revisit that section again, the fruits of your labor will be there to enjoy.

This flies in the face of, “If it ain’t broken, don’t fix it.” But just try it in that one area and see if, the next time you visit that section, you’ll be glad you de-complexified it.

If you looked a bit closer, you would see that @Mdunlop isn’t doing a select at all. Instead, what she has posted is a formula for a Text List object. This allows the filtering to be built into the Text List object itself, no code is required. You can read about this technique here:

Bottom line - selectadditional cannot be used here, this is not a procedure.

Even if this was an application for code was being used to do the selection, I do not agree with the suggestion to use SelectAdditional. First of all, both and and or are being used, so you would have to use a combination of SelectAdditional and SelectWithin. I think this would actually be more difficult to understand than using and and or.

More importantly, the purpose of SelectAdditional and SelectWithin is for use when you don’t know the final selection criteria, but want to develop the selection interactively, piece by piece. That is not the case here.

You could make the formula look more organized with the addition of a few strategically placed carriage returns, like this:

((«selectSearch» = “”) or («Check» contains «selectSearch»))
and ((«paddockSearch» = “”) or («Paddock») contains «paddockSearch»)
and ((«propertySearch» = “”) or («Property») contains «propertySearch»)
and ((«fateSearch» = “”) or (exportcell(«Fate») contains «fateSearch»)) 
and ((«idSearch» = “”) or (exportcell(«TotalID») contains «idSearch») or (exportcell(«Unique») contains «idSearch»)) 
and ((«sellSearch» = “”) or («Sell» contains «sellSearch»)) and ((«whpSearch» = “”) or («WHP»)>today() or («ESI»)>today())
and ((«dateSearch» = “”) or (exportcell(«DateSeen») contains «dateSearch»))

This sort of formatting works well for code in the procedure editor, but is not so helpful for formulas in a graphic object because the area for the formula is so narrow. So even with the carriage returns it would still not look very organized, and I usually don’t bother with trying to make a formula in a graphic object look “pretty”. Though sometimes for a complicated formula if I’m having trouble figuring out a problem I will copy it to an external editor like BBEdit and format it.

Oops - or should I say OOP (encapsulating the code with the object). I thought I’d seen everything, and I’ve been to two rodeos and a circus. :slightly_smiling_face: