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

Dave Britten davidbrit2 at gmail.com
Sun Jul 16 16:37:13 CEST 2017


Thanks Tim. That exact approach had crossed my mind, and I think it would work in most cases, but there's always a catch. If I want to do some kind of special promotion like "Buy 3 get 1 free", then I wouldn't be able to set a $0 price on the items that were free due to the promotion.

I've been playing around with DP this morning (a rather pleasant way to spend a quiet morning at our camp site), and I've found a rather interesting DP behavior that I'd like to confirm is intentional, or whether I've discovered some kind of bug/unintentional feature. In short, "Automatically computed when record is created" seems to have functionality beyond what the name suggests.

I made a test database with two panels: ITEMS.DAT and SALES.DAT. The Items panel has two fields:
P2F1 - A20 - Item
P2F2 - G$ZZ9.99 - Price

There is one index on the Item field.

The Sales panel has four fields:
P3F1 - A20 - Item
P3F2 - G$ZZ9.99 - Sell Price
P3F3 - GZZ9::I - Sale ID

There is one index on the Sale ID field, and Item is a data link back to the Item field in the Items panel.

The Sell Price field is computed as simply "P3F1P2F2", i.e. the Price field from the Items panel. This field is set to "Automatically computed when record is created". You would think that the field would only be computed when pressing F9 to create a record, but it actually recomputes any time you select a new linked record for the Item field, you are in CREATE mode, and you have not made any changes to the Sell Price field manually. You may reselect a linked Item as much as you want, and the price will update automatically, but as soon as you manually enter a value Sell Price, it stops updating automatically. Also, in EDIT mode, the field does not update automatically at all. In other words, that's pretty much exactly what I want it to do.

Before I rely on this too heavily, can anybody confirm that this is intended (but seemingly undocumented) behavior? I don't believe I've seen it mentioned anywhere in either the DP manual, or "Mastering DataPerfect".

-Dave Britten

> On Jul 8, 2017, at 9:54 AM, Tim Rude <timrude at hotmail.com> wrote:
> 
> You don't need a hidden field on the Invoice Line Item panel to hold the 
> desired price since that info is readily available through the item link.
> 
> Simply set the formula on your 'selling price' field in the Invoice Line 
> Item panel to: IF [selling price] = 0 THEN [desired price through the 
> item link] else [selling price] ENDIF
> 
> Set the 'selling price' field to update on any change. That way when you 
> first create the Invoice Line Item record, because the 'selling price' 
> is initially zero it auto-updates to the 'desired price'. But then you 
> can adjust it to whatever you want (except zero) and it will stick.
> 
> Tim Rude
> 
>> On 7/7/2017 1:00 PM, 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
> 
> _______________________________________________
> Dataperf mailing list
> Dataperf at dataperfect.nl
> http://lists.dataperfect.nl/cgi-bin/mailman/listinfo/dataperf


More information about the Dataperf mailing list