Questions tagged [tvalue]

TValue is a Delphi data structure that can store different kinds of data types to ease the access to fields and method parameters. It is defined in the Rtti.pas unit.

18 questions
10
votes
1 answer

Delphi XE: Where is my TValue.Equals()?

It seems that one, in my opinion mandatory method is missing from TValue; TValue.Equals(TValue). So whats a fast and decent way of comparing 2 TValues, preferably without the use of TValue.ToString(), which allows false matches between variants,…
Marius
  • 3,043
  • 1
  • 15
  • 24
5
votes
4 answers

Converting an string to a enum type using TValue?

I want to convert an string to an enum type using TValue, I googled but I didn't find how to do that. type TEnumTest = (etFirst, etSecond); var D: TEnumTest; begin D := StrToENumTest('etFirst'); end; function…
Fabricio Araujo
  • 3,810
  • 3
  • 28
  • 43
4
votes
1 answer

RTTI Delphi Create as TValue an n-dimensional matrix

Good day, TValue is a Delphi-2010 and up RTTI feature. Following on from my earlier question, I had tried to make recurrent function to return a TValue as a n-dimensional. matrix(2D, 3D, 4D...) for example, this procedure will show a n-dimensional…
user558126
  • 1,303
  • 3
  • 21
  • 42
4
votes
1 answer

Delphi 2010 RTTI : Use TValue to store data

I would like to be able to use TValue to store Data in a TList<>. Like in : type TXmlBuilder = class type TXmlAttribute = class Name: String; Value: TValue; // TValue comes from Rtti end; TXmlNode = class Name:…
ZeDalaye
  • 689
  • 7
  • 17
3
votes
2 answers

Rtti data manipulation and consistency in Delphi 2010

Has anyone an idea, how I can make TValue using a reference to the original data? In my serialization project, I use (as suggested in XML-Serialization) a generic serializer which stores TValues in an internal tree-structure (similar to the…
Christian Metzler
  • 2,971
  • 5
  • 24
  • 30
3
votes
1 answer

Convert a TValue into TDateTime

How can I convert a TValue in TDateTime? I see there are methods like AsInteger, AsDouble, etc. but nothing for TDateTime. var c : TRttiContext; t : TRttiType; f : TRttiField; fieldValue : TValue; fieldDateValue : TDateTime; begin c :=…
Alberto
  • 2,881
  • 7
  • 35
  • 66
2
votes
1 answer

TValue.AsType with enum types in Delphi

Writing this in Delphi uses System.Classes; ... var A: TAlignment; Value: TValue; begin Value := 0; A := Value.AsType(); end; raises EInvalidCast at AsType. Is there a way to cast to any enumeration type from an integer value…
Jouni Aro
  • 2,099
  • 14
  • 30
2
votes
1 answer

Delphi: different PTypeInfo for same type

I am a bit confused about PTypeInfo (and TypeInfo in general) in Delphi - Delphi 10 Seattle to be precise. I ran into following problem: We have an ORM framework (based on Spring4D). Now I want to extend it's abilities to map: Nullable integer…
Jan Drozen
  • 894
  • 2
  • 12
  • 28
2
votes
1 answer

TCheckBox.Data invalid typecast when using as TValue

Steps to reproduce: -new firemonkey-application -add TCheckBox to form Now create a method with following code: procedure TForm1.Foo; var a,b:Integer; lVal:TValue; begin lVal:=TValue.From(42); a:=lVal.AsInteger; …
Art1st
  • 123
  • 2
  • 11
1
vote
1 answer

Setting TValue record in Delphi from known type with RTTI

I have data that is being read in to a RESTful server in the form of name=value pairs. The server code has a mapping of allowed "name" with a corresponding Delphi type and I wish to convert the "value" part (which is received in string format) to a…
David Moorhouse
  • 1,573
  • 3
  • 14
  • 19
1
vote
1 answer

TValue casting to other type

I have uses System.Rtti; procedure TForm1.BitBtn1Click(Sender: TObject); var _UserString: string; _CastedValue: TValue; _IntExampleValue: TValue; _DateTimeExampleValue: TValue; begin _UserString := '55'; _IntExampleValue :=…
Edijs Kolesnikovičs
  • 1,627
  • 3
  • 18
  • 34
0
votes
0 answers

get model.tvalues instead of model.bse from statsmodels summary2

I run a couple of regressions and I tabulate the results using summary2: import statsmodels.api as sm from statsmodels.iolib.summary2 import summary_col mod1 = sm.OLS(df['y'], sm.add_constant(df['x']).fit() mod2 = sm.OLS(df['y'],…
user9875321__
  • 195
  • 12
0
votes
1 answer

Blazor - FluentNumberField does not work unsigned types

I am not able to use an uint32, int16, ... when using the FluentNumberField. Age I cannot change the field type to int because this is what is expected in the Sql…
Coder6652
  • 1
  • 1
  • 3
0
votes
1 answer

How to dynamically set TValue property of InputNumber component

We can assign and re-use the TValue with help of typeparam in the Blazor platform. But, how will we assign the TValue dynamically for Blazor InputNumber component? code example: [index.razor] @*The below definiton is working*@ …
0
votes
0 answers

Embarcadero C++ Builder data structure that can store different complex data types

I am using C++ Builder 10.2.3. I need to store from simple to complex data types, and restore them: int float . . std::vector std::vector() /* Transform is a user created class*/ etc... I already tried Variant and TValue.…
Louis
  • 75
  • 6
1
2