Conversion the type TValue to as Variant lazarus / 21-General ---------------------------------------------------------------------- emivaldo · 2021-03-14 21:14 Hi Everyone I am trying to convert a value of type TValue to variant. However, the Lazarus RTTI does not have the AsVariant function. Friends would have another way out for this conversion. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   class function TModelUtils.TValueFromVariant(AValue: TValue; AField : TFieldType): Variant;begin   case AField of    ftString: Result :=  AValue.AsString;    ftInteger: Result := AValue.AsInteger;    ftBoolean: Result := AValue.AsBoolean;    ftCurrency: Result := AValue.AsCurrency;    ftDateTime: Result := TDateTime(AValue.AsExtended);    ftDate: Result     := TDate(AValue.AsExtended);    ftTime: Result     := TTime(AValue.AsExtended);    //ftByte:            := TTime(AValue.AsBytes);       ****** Error    //ftExtended:        := TExtended(AValue.AsExtended);    *******Error  end; end; I tried to create the function above, but there are still some types that I can't convert.... Thanks ---------------------------------------------------------------------- emivaldo · 2021-03-15 13:51 Hi jamie. Thanks for answering. I tried to use Double but it is wrong, and it is only right with Extended. How would I convert the value that is in TValue to TVarData. Because my difficulty is to remove the information from TValue and convert it to the most commonly used types. However, I didn't find many conversion options using RTTI. Is there no class in the lazarus that would be able to use pointers and memory address to convert the TValue value ?? ---------------------------------------------------------------------- ASBzone · 2021-03-15 18:41 Quote from: emivaldo on March 15, 2021, 02:51:57 pmI tried to use Double but it is wrong, and it is only right with Extended. Consider the following (as it relates to the double vs extended part of your query): https://forum.lazarus.freepascal.org/index.php?topic=43878.15 http://free-pascal-general.1045716.n5.nabble.com/Freepascal-Floating- Point-Issue-td5729579i20.html