Using data store component in php include?

Hi all,
If any one can help would be appreciated/put me straight on this.

Is it possible to use the datastore bindings/content on the parent page, where a php include uses and loads data into a datastore component?

If I do this with a database query (on the php include ) the correct data/schema is displayed in the parent page bindings.

But if I try and do this with a datastore (whose schema is defined and has data in) all I get for binding options is:
Datastore_name.data
(with no corresponding data schema after .data)

Many thanks for any help,
Jon

I'm not 100% sure but I think you may have found a bug.

1 Like

The issue is repeatable, with the same bug/error happening on multiple projects/tries, but I have found if you know the name and index position you can call up the data accordingly though.
I.e.

Datastore_name.data[0].var_name

Just not visible through app bindings.
Hope this helps someone till it's recognised as a bug/fixed

Cheers

I've changed the thread to 'bug' but if it turns out not to be then it will be changed back.

1 Like

The data store schema is defined and stored for the page id where it is added.
I am not sure i understand where your data store component is located and where are you trying to call it from?

Thanks for the quick reply,

The datastore is in a header.php that i'm using as a server side include.
If I try and access its data on the page its inlcuded on (lets call it master.php) I get the behaviour stated above.
(If this is the expected behaviour I understand)

The only only reason for the question was if I do this with a serverconnect performing a database read (on the header.php) It is accessible with full schema and normal behaviour on the master.php page.

Im just doing my best to avoid unnecessary db reads!
Cheers

Its a quite commonly seen bug, Wappler just doesn't always get it right when the repeat/ store you are using is outside the current repeat you are in.
Wappler simply doesn't know which record you want as the repeat is out of scope so it seems to fall back on record{0].

Did you create the data store on the main page and the move it in an include, or was the include already created and you added the data store there?

The include was built separately and then added to the specific page.