Python sets, frozensets, and literals
Python sets, frozensets, and literals
Posted Jan 25, 2022 8:57 UTC (Tue) by Wol (subscriber, #4433)In reply to: Python sets, frozensets, and literals by NYKevin
Parent article: Python sets, frozensets, and literals
Like you, I need to create an index on DATE, so evens there. I'd rather put a date in the query, but adding another column to the invoice is easy
ED DICT INVOICES
... create AGE as TODAY - INVOICE.DATE
I think Pick would struggle with me creating an index on a dynamically created field ... :-)
Then it's something as simple as
LIST INVOICES WITH INVOICE.DATE > 25/12/2022 ITEM.NAME ITEM.QUANTITY GRAND.TOTAL ITEM.QUANTITY BY ITEM.NAME.
Okay I'd need to make sure I got the syntax right, but it cost me more time to understand what you were doing than to come up with my first cut at the Pick equivalent. And now I see you're also comparing against current inventory ...
LIST INVOICES WITH INVOICE.DATE > 25/12/2022 ITEM.CODE ITEM.NAME ITEM.QUANTITY GRAND.TOTAL ITEM.QUANTITY BY ITEM.NAME EVAL(TRANSLATE PRODUCTS ITEM.CODE STOCK) AS STOCK EVAL (STOCK - ITEM.QUANTITY) AS SURPLUS
There's probably a bit more to it than that, I've never had to write that sort of query before, but that's about it. Nested Pick queries are more likely to be written as procedures than command lines. (Note the translate instead of a join...)
Cheers,
Wol