So what doesn’t work is:

$sharedObj:=New Shared Collection
OB_CopyToSharedObject ($catalogObj;$sharedObj)
Use (Storage.MySharedCollection)
        Storage.MySharedCollection.push($sharedObj)
End use 


What does work is: 

Storage.MySharedCollection.push(New shared object)
Use (Storage.MySharedCollection[Storage.MySharedCollection.length-1])
        OB_CopyToSharedObject 
($catalogObj;Storage.MySharedCollection[Storage.MySharedCollection.length-1])
End use 

So it looks like you can’t .push() a shared object onto a shared collection.

Jim Crate


> On Sep 9, 2019, at 8:39 PM, Jim Crate via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> I’m retrieving some info from an API that I’d like to cache, and I’m using 
> v17, so I thought Storage might be a nice alternative to a process or 
> interprocess variable. The first obstacle is that I can’t add an object from 
> the API response to a shared collection. I found a KB article with a couple 
> methods to copy a regular object to a shared object, functionality which is 
> inexplicably missing from 4D. However, when adding the shared object to the 
> shared collection, I get the error: “This shared obuject already belongs to 
> another shared group.”
> 
> Aside from the fact that I shouldn’t even need the code from the KB, once 
> I’ve copied an object into a shared object, how can I put that shared object 
> into a shared collection? This is something that should "just work”. As it is 
> I guess I’ll go back to a process variable for now. 
> 
> https://kb.4d.com/assetid=78197
> 
> Jim Crate
> 
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **********************************************************************

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to