Page 1 of 1

copy and pasting more than 1 item

Posted: Wed May 21, 2014 11:05 pm
by jalz
Hi Guys,

I've stumbled on an issue which I need a bit of assistance with please. I currently have a script
copy group "Purchases" of card "ItemLibrary" of stack "ItemLibrary"

which copies a layout object from one card and then using the paste function pastes it into a brand new card multiple times depending on the amount of data. This seems to works great!

I need to build more things onto that card, such as I would like to bring in logo, a footer etc. These are all objects that exist on different cards.I could use the same technique of copy and pasting the objects from one card/stack to another. However I believe the copy function only holds one object in memory and I need to hold and reference 4/5.

Is there a simple way I can copy 4/5 items that exist on separate stacks and paste them accurately on the card that script is working for.

Thanks as always
Jalz

Re: copy and pasting more than 1 item

Posted: Thu May 22, 2014 3:33 am
by dunbarx
Hi.

The "copy" command can only hold one object reference at a time. The good news is that this command is quite flexible:

copy sourceObject of card sourceCard of stack sourceStack to card destinationCard of stack destinationStack

That sort of thing.

Anyway, even if you were able to navigate around to collect several objects and place them all into one comprehensive "copy", you would require no more time to navigate around and copy one at a time.

Craig Newman

Re: copy and pasting more than 1 item

Posted: Thu May 22, 2014 11:00 pm
by jalz
Thanks Craig,

That sorted it 75% of my copy and paste woes... I have another extended question regarding copy.

I have a text field on a card which contains some text. I want to copy the contents of that field into another card and place it in as a label field, i.e. in a non editable format. When I use the
copy sourceObject of card sourceCard of stack sourceStack to card destinationCard of stack destinationStack
this copies the text field across but not the actual text contents. I thought if I could copy the the field across with the content I could possibly then make the field not in focus, remove borders etc so it looks like a label field.

As the card I am copying to does not have a label field defined where I can "put" the content in, because the card is built up from scratch when requested by code. Is there an efficient way to transfer contents of a text field into a card which has no field objects defined.

Best
Jalz

Re: copy and pasting more than 1 item

Posted: Thu May 22, 2014 11:53 pm
by dunbarx
Hi.

I think I lost the post I made to you. Anyway,

I would set properties of the templateField to the properties of a typical label field. Then when you copy, the field should look right. Note that a label field is just a field, though with its own properties. This is all untested. For example, the text of the parent field is a property, but the text of the templateField might be anything. So you will at a minimum have to set this after copying. This is easy to do, fortunately.

Work this. Let me know how you fare. I expect you will have to do a bit of tweaking...

Craig