>> I'm asking for a best practice tip to achieve the following in A4D:
>>
>> Have 3 4D database tables named cart, backorder, stock.
>>
>> Want to create 2 new temporary tables "final_cart" and "final_backorder",
>> that differ from cart and backorder in, that products in cart with no stock
>> are moved to final_backorder and products in backorder with stock are moved
>> to final_cart.
>>
>> As this is solely for preview on the web, I do not want to generate real 4D
>> tables for that task.
>
> Were you able to get this to work with collections?
Yes, I got it working, but with a bunch of collections, one for each field,
and not a single collection with arrays.
I've made it before I've read your post
> The key words there are "with an array". So yes, you have to either declare
> the array directly in the collection:
>
> array longint($final_cart{"itemno"}; 0)
Later on I've converted it to just use 4D arrays, as I needed the almost
same method within 4D.
The 4D command "selection to array" IMHO is the keypoint to give arrays the
edge over collections, as it saves you to declare each array before you can
use it.
I still think that the collection suit is missing a command "Selection to
Collection" to streamline the population of a collection from a selection
(see my older post "Selection to Collection / Array to Collection") .
This command would generate a single collection with keys according to the
field name and arrays as value declared accordingly to the type of the
field.
Parameter "->Table" would be required, others could be optional.
Without optional parameters given, it would create a collection over all
fields of the table with keys automatically set to the field name.
With just field names given, it would generate a collection over these
fields with keys automatically set to the field name.
Witch "field name/key" pairs, it would do the same but use "key" instead of
the field name, thus isolating the collection keys from the database
structure.
Peter
_______________________________________________
Active4D-dev mailing list
[email protected]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/