Hi Guys,
I have a card, which contains multiple grouped objects called PurchaseLineX (x being the instance number). The thing is, I may have a card which contains only one PurchaseLine group, or I may have a card which could contain upto 30 PurchaseLine Groups. I'm trying to write some initialisation routine, which scans the card for any PurchaseLine groups and deletes them.
Anyone know of a simple way to achieve this, or is it more efficient if I delete the card and then recreate it with the header, footer information, before populating the data with the PurchaseLine information.
Thanking you in advance.
Jalz
open card and delete multiple grouped objects
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
open card and delete multiple grouped objects
Last edited by jalz on Tue Apr 22, 2014 9:23 am, edited 1 time in total.
Re: ope card and delete multiple groups
Hi.
Now how does this work? In other words, why count down instead of up? Do you see that we do not have to (though we certainly could) consider the number of each "purchaseLine" group, that we can use another "property" to identify them? In fact, why not rewrite this handler in a way that does indeed use the several "purchaseLine1, purchaeLine2, etc." group names. Consider that payment for the code snippet.
Write back with what you find.
Craig Newman
Code: Select all
on opencard
repeat with y = the number of groups down to 1
if the short name of group y contains "purchaseLine" then delete group y
end repeat
end openCard
Write back with what you find.
Craig Newman
Re: open card and delete multiple grouped objects
Hi Craig,
That is awesome, does exactly what I want. I used the debugger to walk through and understand the code, added other grouped objects but without the same name, works bang on. Would not of thought counting up...
Thanks
Jalz
That is awesome, does exactly what I want. I used the debugger to walk through and understand the code, added other grouped objects but without the same name, works bang on. Would not of thought counting up...
Thanks
Jalz
Re: open card and delete multiple grouped objects
Hi Jalz,
Not really sure if I can explain it correctly, but why does this not work;
and this does
???
Simon
This will twist your brain!why count down instead of up?
Not really sure if I can explain it correctly, but why does this not work;
Code: Select all
on mouseUp
put "delete me" & comma & "save me" & comma & "delete me" & comma &"delete me" into tTest
repeat with x = 1 to the number of items in tTest
if item x of tTest contains "delete me" then
delete item x of tTest
end if
end repeat
answer tTest
end mouseUp
Code: Select all
on mouseUp
put "delete me" & comma & "save me" & comma & "delete me" & comma &"delete me" into tTest
repeat with x = the number of items in tTest down to 1
if item x of tTest contains "delete me" then
delete item x of tTest
end if
end repeat
answer tTest
end mouseUp
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: open card and delete multiple grouped objects
Hi Simon,
Thanks for your snippet of code. I was really confused until I got into the debugger to see what was going on and of course its logical when you think about it and walk through your example....
Thanks
Jalz
Thanks for your snippet of code. I was really confused until I got into the debugger to see what was going on and of course its logical when you think about it and walk through your example....
Thanks
Jalz