[Dataperf] Recompute a field when a selection is made in a data-linked field?

Jacques Gaijin j_gaijin at dds.nl
Sat Jul 8 10:26:33 CEST 2017


Hello Dave,

My choice would be quite simple  Program so that the invoice is printed 
with the price you really made, as an entry value. You could combine 
that with the "official" sales price and provide on the invoice the 
discount you have given.

Now comes the point you are after. Make an extra field, G9 in both the 
invoice panel and the "stock/price" panel. I would call it P4F9.  In the 
invoice panel, call it for clarity P6F8, you make the same field and a 
link to P4F9. Add the  formula: <if P6F8P4F9 = 0 then 1 else -1 endif> 
and force to add the value to P4F9. Now every time you print an invoice, 
either 1 is added, or subtracted to P4F9. This change  forces Panel 4 to 
recompute its values.

If you would also wish to keep track of your stock, it could make it a 
lot easier, for then you just subtract the amount you sell in the 
invoice from the total amount you have in stock on the price panel. That 
would also trigger an edit in the price panel. The trick is to force a 
recalculation by adding (or subtracting) a value each time you add an 
invoice.

If you don't care keeping track of your sales, you could even omit 
having an invoice panel and create each invoice using a printout from 
the price panel and storing an RV-value..

Good luck, Jacques

On 08-Jul-17 03:00, Dave Britten wrote:
> Greetings all,
>
> I've been banging my head against this one for a couple hours now, but a lot of reading and experimenting with formula tricks hasn't gotten me anywhere.
>
> Short version: How do I make a field on a panel refresh itself with a value from another related panel whenever the selected value in the data-linked field changes? This field should NOT be part of the data link key, i.e. I should be able to change it afterwards without breaking the link.
>
> Longer version:
>
> I'm making a small sales database for selling some stuff at a flea market later this summer. The issue here involves three panels: items, invoices, and invoice lines. The items panel has a price field, where I store the sticker price of the item. The invoices panel has a panel link to the invoice lines panel. The invoice lines panel has an item field, which has a data link back to the items panel, allowing for selecting an item. The invoice lines panel also has its own price field, because I may sell an item for a price other than what I had marked it (it's a flea market, after all).
>
> What I'd like to have happen is when I press F5 on the invoice panel link to create an invoice line item, the invoice line's price field gets automatically filled when I select a record in the item field using the up arrow. But I need the price on the invoice line to be updatable, and I don't want the change to cascade back to the items panel or sever the link.
>
> I tried adding a second field (which would eventually be hidden) to the invoice lines called "Selected Price", set to calculate as the sticker price of the selected item at any change. Then I had the main invoice line price field calculate something like this:
>
> IF [Selected Price] <> [Price Field In Items Panel] THEN [Price Field In Items Panel] ELSE [Price] ENDIF
>
> That didn't seem to get my anywhere, as I haven't found a way to convince DP to compute that field BEFORE computing the value for the "Selected Price" field.
>
> Any ideas? Thanks.
>
> -Dave Britten
> _______________________________________________
> Dataperf mailing list
> Dataperf at dataperfect.nl
> http://lists.dataperfect.nl/cgi-bin/mailman/listinfo/dataperf



More information about the Dataperf mailing list