RTC Forums
November 21, 2024, 01:28:52 PM
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Help
Login
Register
RTC Forums
>
Subscription
>
Support
>
TRtcInfo loop
Pages: [
1
]
« previous
next »
Print
Author
Topic: TRtcInfo loop (Read 5363 times)
sstuman
RTC Expired
Posts: 6
TRtcInfo loop
«
on:
December 24, 2018, 05:20:14 AM »
serversList := TRtcInfo.Create;
with serversList do
begin
NewChild('{ACC2EE017-C7E6-45F7-A853-9064A81B723D}');
NewChild('{BCC2EE017-C7E6-45F7-A853-9064A81B723D}');
NewChild('{CCC2EE017-C7E6-45F7-A853-9064A81B723D}');
SetNil('{BCC2EE017-C7E6-45F7-A853-9064A81B723D}');
end;
How to loop serversList?
Example for i := 0 to serverList.Childs.Count - 1 do.... but no Childs property...
Logged
sstuman
RTC Expired
Posts: 6
Re: TRtcInfo loop
«
Reply #1 on:
December 24, 2018, 06:18:01 AM »
var
f: TRtcRecord;
begin
f := TRtcRecord.Create;
f.AutoCreate := False;
f.NewBoolean('111');
f.asBoolean['111'] := True;
////////////////////////////////f.Count = 1
f.NewBoolean('222');
f.asBoolean['222'] := True;
////////////////////////////////f.Count = 2
f.isNull['111'] := True;
////////////////////////////////f.Count = 2 How to delete field from record?
FreeAndNil(f);
endl
Logged
D.Tkalcec (RTC)
Administrator
Posts: 1881
Re: TRtcInfo loop
«
Reply #2 on:
December 24, 2018, 08:05:23 AM »
1. "asObj", "asPtr" and "NewChild" methods of the "TRtcInfo" class store objects in a quick-search-tree, which only keeps the original string and the object pointer. There is no integer index associated with each element, so there is no way to find these objects by an integer index and there are no iteration functions to loop through "asObj", "asPtr" and/or "Child" elements.
2. Even though the object assigned to a "TRecord" field is released from memory if you set "isNull" to TRUE, the name of the field and its integer index (allocated while creating the field) remain occupied and will be re-used if you assign a different value to the field. There is no way to remove the field name and/or reduce the field count after assigning a field to a record, without destroying the entire record. The purpose of this "limitation" (no field deletion after creation) is (A) to make it possible to store and transfer record fields containing the value "NULL" (=NIL) while keeping the field type information preserved, and (B) to make sure the index of a field inside a record (which can be used to access fields by integer and enumerate through all fields) never changes once a field was created, even if there is no data stored inside the field (field value is "NULL").
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Dashboard
-----------------------------
=> General
=> 3rd-Party
=> Quick Start
-----------------------------
Subscription
-----------------------------
=> Support
Loading...