Frequently Asked Component Specific Questions
Options |
Display all FAQ items |
Displaying items 1 to 1 of 1, page 1 of 1
<< previous next >>



Putting data in the cloud with myCloudData.net and component TAdvmyCloudData
If we’d want to persist application settings information in the cloud on http://myCloudData.net, this is very simple to do in Delphi.
After connecting with TAdvmyCloudData, we can test for the presence of the table that holds the data to persist, create table & metadata when it doesn’t exist and persist the data.
Code:
var table: TmyCloudDataTable; entity: TmyCloudDataEntity; doins: boolean; begin table := AdvMyCloudData1.TableByName(''APPDATA''); // create table with metadata on the fly if it doesn’t exist for the myCloudData.net account if not Assigned(table) then begin table := AdvMyCloudData1.CreateTable(''APPDATA''); table.MetaData.Add(''WINWIDTH'', ftInteger); table.MetaData.Add(‘WINHEIGHT’,ftInteger); table.MetaData.Add(''WINLEFT'', ftInteger); table.MetaData.Add(''WINTOP'', ftInteger); table.MetaData.Add(''USERNAME'', ftString,50); end; // check for existing entity holding the data table.Query; doins := table.Entities.Count = 0; if doins then entity := table.Entities.Add else entity := table.Entities[0]; // setting data to persist in the entity entity.Value[‘WINWIDTH’] := form.Width; entity.Value[‘WINHEIGHT’] := form.Height; entity.Value[‘WINLEFT’] := form.Left; entity.Value[‘WINTOP’] := form.Top; entity.Value[‘USERNAME’] := GetWindowsUser(); // inserting or updating entity if doins then entity.Insert else entity.Update; end;