Icon View Thread

The following is the text of the current message along with any replies.
Messages 11 to 15 of 15 total
Thread use local storage temporary
Wed, Jan 15 2014 4:48 AMPermanent Link

Mike

Thank you for the help!

The dataset (dataset1) is put on a separate form (called datamodule), unit datamodule is added to main and child form.

On the main page is a grid which should be pointed to the dataset on the datamodule form.

Tried this but frmDatamodule.dataset1 is not allowed.

Shouldn't this work this way?
Wed, Jan 15 2014 6:07 AMPermanent Link

Matthew Jones

I would expect it to work, but what is the error?
I presume the unit is included. Is the datamodule dataset public?
Or perhaps it needs to be wired up at runtime if the IDE doesn't allow it to be
connected. I don't know about this aspect of EWB.

/Matthew Jones/
Wed, Jan 15 2014 12:27 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Mike,

<< Is it not possible to save the fields to a dataset (defined at design
time) via

LocalStorage.Set(dsDocuments.DataSetName, dsDocuments.GetRows);

and load them via

dsDocuments.LoadRows(LocalStorage.Items[dsDocuments.DataSetName]); ? >>

Yes, it's possible.  That's exactly what the DataSetClient example
demonstrates:

procedure TDataSetForm.SaveDatabaseButtonClick(Sender: TObject);
begin
  LocalStorage.Set(Biolife.DataSetName,Biolife.GetRows);
  LocalStorage.Set('Transactions',Database.GetTransactions);
end;

procedure TDataSetForm.LoadDatabaseButtonClick(Sender: TObject);
begin
  if LocalStorage.Exists('Transactions') then
     Database.LoadTransactions(LocalStorage.Items['Transactions'])
  else
     ShowMessage('Transaction operations not found in local storage');
  UpdateButtons;
  if LocalStorage.Exists(Biolife.DataSetName) then
     Biolife.LoadRows(LocalStorage.Items[Biolife.DataSetName])
  else
     ShowMessage('Biolife dataset not found in local storage');
end;

What *specific* problems are you seeing when you try to do the above ?

Tim Young
Elevate Software
www.elevatesoft.com
Wed, Jan 15 2014 12:29 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Mike,

<< Is it always necessary to connect to a database when using a dataset? >>

No, in fact the TDataSet never really knows where the JSON is coming from,
and has no knowledge of the back-end database(s).

<< When I use the following code: >>

Don't use the native HTML5 DOM objects, use the wrappers instead:

http://www.elevatesoft.com/manual?action=viewcomp&id=ewb1&comp=TPersistentStorage

Tim Young
Elevate Software
www.elevatesoft.com
Wed, Jan 15 2014 3:10 PMPermanent Link

Mike

@Matthew
I got it working. After removing the grid and adding a new grid it could connect to the dataset.

@Tim
Thanks for the hint. I will try this.
« Previous PagePage 2 of 2
Jump to Page:  1 2
Image