Remove element from collection

View: New views
4 Messages — Rating Filter:   Alert me  

Remove element from collection

by Anton Pirker :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi List!

I have a collection events in the HopObject User. Now i want to remove
one event from the users list of events by doing: (but it should stay in
the database and other collections of the application)

        session.user.events.remove(eventObj);


this happens in the action. after this i render a skin where a macro is
called where i check for existence of the removed event

        if(session.user.events.get(eventId)) { do something }

the problem: the collection is not updated (the event is not removed) to
the if-statement is always true. only when i restart helma the event is
gone.

how can i remove an element from a collection so that it is removed
immediately so that i can check for its (non)existence in the same
request and get the right result.


cheers,
Anton


--
DI(FH) Anton Pirker, Helma Freelancer
_______________________________________________
Helma-user mailing list
Helma-user@...
http://helma.org/mailman/listinfo/helma-user

Re: Remove element from collection

by Walter Krivanek, VividVisions :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Anton,

I think, res.commit() is what you're looking for.
http://helma.zumbrunn.net/reference/res.html#res.commit

Bye,
Walter

Anton Pirker (10.04.2008 11:52):

> Hi List!
>
> I have a collection events in the HopObject User. Now i want to remove
> one event from the users list of events by doing: (but it should  
> stay in
> the database and other collections of the application)
>
> session.user.events.remove(eventObj);
>
>
> this happens in the action. after this i render a skin where a macro  
> is
> called where i check for existence of the removed event
>
> if(session.user.events.get(eventId)) { do something }
>
> the problem: the collection is not updated (the event is not  
> removed) to
> the if-statement is always true. only when i restart helma the event  
> is
> gone.
>
> how can i remove an element from a collection so that it is removed
> immediately so that i can check for its (non)existence in the same
> request and get the right result.
>
>
> cheers,
> Anton


_______________________________________________
Helma-user mailing list
Helma-user@...
http://helma.org/mailman/listinfo/helma-user

smime.p7s (3K) Download Attachment

Re: Remove element from collection

by Anton Pirker :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Walter!

Walter Krivanek, VividVisions schrieb:
> Hi Anton,
>
> I think, res.commit() is what you're looking for.
> http://helma.zumbrunn.net/reference/res.html#res.commit

This does not do the trick..

It seems that .removeChild(childObj) has no effect at all when the
childObj ist still in the database.

Has anybody else an idea?
Any help greatly appreciated!

Greetings from sunny Vienna,
Anton



--
DI(FH) Anton Pirker, Helma Freelancer
_______________________________________________
Helma-user mailing list
Helma-user@...
http://helma.org/mailman/listinfo/helma-user

Re: Remove element from collection

by Anton Pirker :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I found the error.

i had a wrong .accessName in the definition of my collection so .get()
returned something when it should not.

sorry for the noise,
Anton



Anton Pirker schrieb:

> Hi Walter!
>
> Walter Krivanek, VividVisions schrieb:
>> Hi Anton,
>>
>> I think, res.commit() is what you're looking for.
>> http://helma.zumbrunn.net/reference/res.html#res.commit
>
> This does not do the trick..
>
> It seems that .removeChild(childObj) has no effect at all when the
> childObj ist still in the database.
>
> Has anybody else an idea?
> Any help greatly appreciated!
>
> Greetings from sunny Vienna,
> Anton
>
>
>


--
DI(FH) Anton Pirker, Helma Freelancer
_______________________________________________
Helma-user mailing list
Helma-user@...
http://helma.org/mailman/listinfo/helma-user