Welcome, Guest. Please Login
Rorohiko Workflow Resources
  Welcome the Message Board of Rorohiko Workflow Resources. To register, please e-mail [email protected] - automatic registration has been turned off because of relentless spambots and spammers. This Message Board is not actively monitored. If you have an urgent question, please e-mail [email protected] If you post it here, it will probably be many weeks before we notice.
  HomeHelpSearchLogin  
 
Page Index Toggle Pages: 1
Send Topic Print
APID  - how to access all dataStore entries? (Read 9533 times)
weller
YaBB Newbies
*
Offline


I Love YaBB 2!

Posts: 10
APID  - how to access all dataStore entries?
01/19/09 at 01:39:20
 
Is there a way to retrieve an array or object with all saved variables?
I know I can use item.getDataStore('key'), but that can only help if I know the keys.


Thanks for help
weller
Back to top
 
 
IP Logged
 
Harbs
YaBB Newbies
*
Offline


Kris Does Great Work ;-)
!

Posts: 13
Gender: male
Re: APID  - how to access all dataStore entries?
Reply #1 - 01/19/09 at 04:57:51
 
You're joking. Right?

You're asking if there's a skeleton key or a lock-pick set?  Shocked

Keys are for locking doors!  Grin
Back to top
 
WWW  
IP Logged
 
Kris Coppieters
YaBB Administrator
*****
Offline



Posts: 181
New Zealand
Gender: male
Re: APID  - how to access all dataStore entries?
Reply #2 - 01/19/09 at 06:10:36
 
Hi Weller,

Harbs is correct - you're not meant to be able to do that. The 'dataStore' is 'shared space' between multiple developers, and each developer can currently make sure that space stays private by choosing 'secret' keys - you don't want developer A to go poking into developer B's datastores.

So - it's a feature, not a shortcoming!

If you add multiple data store entries and you want to iterate _your_ private entries, one approach is to keep a 'table of contents' of all keys you create and store that into an additional entry - something like (pseudocode - I've not checked my syntax):

Code:
function mySetDataStore(theItem,theKey,theValue)
{
  // extract current table of contents for item. Could be a string or an array
  var theTableOfContents = theItem.getDataStore("com.mycompany.myplugin.mytableofcontents");

  // add if not in table yet - using a string in this example. Assumes keys don't contain "/" char
  // 'Jams' keys between two "/".
  if (theTableOfContents == undefined)
  {
    theTableOfContents = "/" + theKey + "/";
    theItem.setDataStore("com.mycompany.myplugin.mytableofcontents",theTableOfContents);
  }
  else if (theTableOfContents.indexOf("/"+theKey+"/") < 0)
  {
    theTableOfContents += theKey + "/";
    theItem.setDataStore("com.mycompany.myplugin.mytableofcontents",theTableOfContents);
  }

  theItem.setDataStore.setDataStore(theKey,theValue);
}
 



and you then religiously use mySetDataStore instead of .setDataStore, you'd end up with an interable table of contents of your keys (e.g. "/mykey1/mykey2/mykey123/") which is easy to split up and iterate.

Cheers,

Kris
Back to top
 

Kris
WWW  
IP Logged
 
weller
YaBB Newbies
*
Offline


I Love YaBB 2!

Posts: 10
Re: APID  - how to access all dataStore entries?
Reply #3 - 01/19/09 at 10:29:37
 
Thank you for help. The TOC approach works great for me.
It wasn't my intention to ask for anything inappropriate. I'm using APID only to improve my own workflows. That is why I live in blissful ignorance of any security issues.
Back to top
 
 
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print