Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread Oldvalue
Wed, Jun 1 2016 6:46 AMPermanent Link

Huseyin Aliz

myBiss ApS

Avatar

Hi again Smile

I cannot understand why following does not work?

Amountold := Dataset.columns['Amount'].Oldvalue;

Error message:

Expected integer, double or variant but instead found oldvalue

Following works:

Amountold := Dataset.columns['Amount'].asFloat;

Am I missing something, documentation says oldvalue are a property just
like asfloat?

Regards,

Hüseyin

Wed, Jun 1 2016 7:19 AMPermanent Link

Matthew Jones

Hüseyin Aliz wrote:

> Hi again Smile
>
> I cannot understand why following does not work?
>
> Amountold := Dataset.columns['Amount'].Oldvalue;
>
> Error message:
>
> Expected integer, double or variant but instead found oldvalue
>
> Following works:
>
> Amountold := Dataset.columns['Amount'].asFloat;
>
> Am I missing something, documentation says oldvalue are a property
> just like asfloat?

The source is really good for this sort of thing, particularly if you
have a search tool (I use dtSearch as it can share the databases).
Anyway, it finds me a sample with this:

procedure TOrderEntryDlg.RemoveOldLineTotals;
begin
 with Orders do
    begin

Columns['PurchaseTotal'].AsFloat:=(Columns['PurchaseTotal'].AsFloat-Cust
omerItems.Columns['PurchaseTotal'].OldValue.AsFloat);

Columns['ShippingTotal'].AsFloat:=(Columns['ShippingTotal'].AsFloat-Cust
omerItems.Columns['ShippingTotal'].OldValue.AsFloat);
    end;
end;

--

Matthew Jones
Wed, Jun 1 2016 7:25 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com


<< I cannot understand why following does not work?

Amountold := Dataset.columns['Amount'].Oldvalue; >>

OldValue is a TDataValue instance, not a simple value, so you have to use AsString, AsInteger, etc. on it in order to grab the actual value:

http://www.elevatesoft.com/manual?action=viewprop&id=ewb2&comp=TDataColumn&prop=OldValue

Tim Young
Elevate Software
www.elevatesoft.com
Wed, Jun 1 2016 7:49 AMPermanent Link

Huseyin Aliz

myBiss ApS

Avatar

Matthew,

Thank you Smile

Regards,

Hüseyin


Den 01-06-2016 kl. 13:19 skrev Matthew Jones:
> Hüseyin Aliz wrote:
>
>> Hi again Smile
>>
>> I cannot understand why following does not work?
>>
>> Amountold := Dataset.columns['Amount'].Oldvalue;
>>
>> Error message:
>>
>> Expected integer, double or variant but instead found oldvalue
>>
>> Following works:
>>
>> Amountold := Dataset.columns['Amount'].asFloat;
>>
>> Am I missing something, documentation says oldvalue are a property
>> just like asfloat?
> The source is really good for this sort of thing, particularly if you
> have a search tool (I use dtSearch as it can share the databases).
> Anyway, it finds me a sample with this:
>
> procedure TOrderEntryDlg.RemoveOldLineTotals;
> begin
>    with Orders do
>       begin
>
> Columns['PurchaseTotal'].AsFloat:=(Columns['PurchaseTotal'].AsFloat-Cust
> omerItems.Columns['PurchaseTotal'].OldValue.AsFloat);
>
> Columns['ShippingTotal'].AsFloat:=(Columns['ShippingTotal'].AsFloat-Cust
> omerItems.Columns['ShippingTotal'].OldValue.AsFloat);
>       end;
> end;
>
Wed, Jun 1 2016 7:52 AMPermanent Link

Huseyin Aliz

myBiss ApS

Avatar

Tim,

Maybe you should write this as a note, it was not clear for me when i
looked at it Smile

Regards,

Hüseyin



Den 01-06-2016 kl. 13:25 skrev Tim Young [Elevate Software]:
> << I cannot understand why following does not work?
>
> Amountold := Dataset.columns['Amount'].Oldvalue; >>
>
> OldValue is a TDataValue instance, not a simple value, so you have to use AsString, AsInteger, etc. on it in order to grab the actual value:
>
> http://www.elevatesoft.com/manual?action=viewprop&id=ewb2&comp=TDataColumn&prop=OldValue
>
> Tim Young
> Elevate Software
> www.elevatesoft.com
>
Fri, Jun 3 2016 8:10 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

<< Maybe you should write this as a note, it was not clear for me when i looked at it Smile>>

*What* wasn't clear ?  It says right in the documentation that it's a *TDataValue* instance.  A TDataValue instance is a class type, not a primitive type.  This is basic stuff....

Tim Young
Elevate Software
www.elevatesoft.com
Image