I am unsure how to use the component. The docs are not helpful, unfortunately.
How do I set the Authentication?
CallBackURL - As this is an FMX-App and not the web, what do I set here?
ClientID and Key: What am Isupposed to set here? In the myCloudData console I have an APP Key, and an App Name only.
Locale: Whats up with this?
AFAICS there is no Connect or LogIn method? Is it ok to just call the GetTables method?
I´d really appreciate some small demo where I can see, what properties must be set and how to use them.
Trial and error. :- (
Setting CallbackURL to http://127.0.0.1:8888
Key and Locale empty
ClientID is App Key (from myCloudata control panel api key)
Secret is App secret
Now Connect succeeds.
Maybe it is worth noting, that Connect, GetTables and mybe other methods too are async.
procedure TForm1.btn3Click(Sender: TObject);
var
tbl: TTMSFNCCloudMyCloudDataTable;
ent: TTMSFNCCloudMyCloudDataEntity;
begin
tbl := myclLOG.TableByName('WR_LOG');
tbl.Query();
for var i: integer := 0 to tbl.Entities.Count - 1 do begin
ent := tbl.Entities[i];
ml.Lines.Add(ent.ValueAsString['email'] + ' ' + ent.ValueAsString['action']);
end;
end;
The table has records, but they are not retrieved - count is 0.
procedure TForm1.myclLOGQuery(Sender: TObject; const AInfo: TTMSFNCCloudMyCloudDataEntities;
const ARequestResult: TTMSFNCCloudBaseRequestResult);
var
ent: TTMSFNCCloudMyCloudDataEntity;
begin
for var I: integer := 0 to AInfo.Count - 1 do begin
ent := AInfo.Items[I];
ml.Lines.Add(ent.ValueAsString['_ID']);
ml.Lines.Add(ent.ValueAsString['ACTION']);
end;
end;
I think you are wrong. When I call
TTMSFNCCloudMyCloudDataTable.GetMetaData instead of TTMSFNCCloudMyCloudData.GetMetaData, I can access the fields by name and the event is fired.
The GetMetaData call will get all field names from the table specified in TableId.
The Query call will get all entities from the table specified in TableId.