Re: Can Lists be put in storage?

2018-10-08 Thread Chris Belanger via 4D_Tech
Sorry, I figured it out. You CAN store it into storage; I just failed to call:

OBJECT SET LIST BY REFERENCE(*;”cbox_UnitTypes”;Storage.lists.list_UnitTypes)

when I worked at converting my work to use Storage.

---

> On Oct 8, 2018, at 11:30 PM, Chris Belanger  wrote:
> 
> I wanted to store some lists into storage.
> 
> I make an entity selection, then create a LIST using a method ORDA_MakeList.
> The lists are made perfectly (outside of Storage).
> 
> This works flawlessly: the resulting list_UnitTypes works correctly as a LIST.
> 
> $col_UnitTypes:=ds.Unit_Type.all().orderBy("Name asc").toCollection("Name";dk 
> with primary key)
> list_UnitTypes:=ORDA_MakeList ($col_UnitTypes;"Name")
> ——
> 
> However, trying to store the LIST in Storage presents a problem:
> 
> $col_UnitTypes:=ds.Unit_Type.all().orderBy("Name asc").toCollection("Name";dk 
> with primary key)
> Use (Storage)
>   If (Storage.lists=Null)
>   Storage.lists:=New shared object
>   End if 
>   Use (Storage.lists)
>   Storage.lists.list_UnitTypes:=ORDA_MakeList 
> ($col_UnitTypes;"Name")
> … other lists …
>   End use 
> End use 
> 
> Now if the list is referred to in any window / process, then it fails.
> Storage.lists.list_UnitTypes will give an INTEGER VALUE, but it list 
> functions cannot work (i.e. do not recognize it as a list).
> 
> ——
> 
> So am I going to have to store entity selections in storage and convert these 
> to lists inside the windows I use them in?
> I was hoping that LISTS would be ‘interprocess’ in the sense that there is a 
> unique number given to any that are created.
> 
> 
> — thanks, Chris
> 
> p.s.  this is the ORDA_MakeList() method:
>  // ORDA_MakeList(entitySelection;DisplayFieldName) --> list with 
> DisplayFields and __KEYS
> C_COLLECTION($1)
> C_TEXT($2)  // the name of the Display Field
> C_OBJECT($Unit)
> 
> $theList:=New list
> For each ($Unit;$1)
>   APPEND TO LIST($theList;$Unit[$2];$Unit.__KEY)
> End for each 
> 
> $0:=$theList

**
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
**

Can Lists be put in storage?

2018-10-08 Thread Chris Belanger via 4D_Tech
I wanted to store some lists into storage.

I make an entity selection, then create a LIST using a method ORDA_MakeList.
The lists are made perfectly (outside of Storage).

This works flawlessly: the resulting list_UnitTypes works correctly as a LIST.

$col_UnitTypes:=ds.Unit_Type.all().orderBy("Name asc").toCollection("Name";dk 
with primary key)
list_UnitTypes:=ORDA_MakeList ($col_UnitTypes;"Name")
——

However, trying to store the LIST in Storage presents a problem:

$col_UnitTypes:=ds.Unit_Type.all().orderBy("Name asc").toCollection("Name";dk 
with primary key)
Use (Storage)
If (Storage.lists=Null)
Storage.lists:=New shared object
End if 
Use (Storage.lists)
Storage.lists.list_UnitTypes:=ORDA_MakeList 
($col_UnitTypes;"Name")
… other lists …
End use 
End use 

Now if the list is referred to in any window / process, then it fails.
Storage.lists.list_UnitTypes will give an INTEGER VALUE, but it list functions 
cannot work (i.e. do not recognize it as a list).

——

So am I going to have to store entity selections in storage and convert these 
to lists inside the windows I use them in?
I was hoping that LISTS would be ‘interprocess’ in the sense that there is a 
unique number given to any that are created.


— thanks, Chris

p.s.  this is the ORDA_MakeList() method:
  // ORDA_MakeList(entitySelection;DisplayFieldName) --> list with 
DisplayFields and __KEYS
C_COLLECTION($1)
C_TEXT($2)  // the name of the Display Field
C_OBJECT($Unit)

$theList:=New list
For each ($Unit;$1)
APPEND TO LIST($theList;$Unit[$2];$Unit.__KEY)
End for each 

$0:=$theList
**
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
**