cancel
Showing results for 
Search instead for 
Did you mean: 

Invalidate of ContextNode doesn't seem to work

Former Member
0 Kudos

Hi There,

I try do delete/clear all elements of a certain node

I have read some topics where it is suggested to use invalidate.

I tried the following

this is the node:

A

-- A1

-- A2

-


A21

-


A21

-- A3

I want to clear all the elements of node A2. Node A2 has a cardinality of 0..n

I use the statement wdContext.nodeA2().invalidate();

Just as a test before and after this invalidate statement i ask the length of the node.

like .....

Int numberBefore = wdContext.nodeA2().size());

wdContext.nodeA2().invalidate()

Int numberAfter = wdContext.nodeA2().size());

Both numberBefore and numberAfter contain the same result value.

What am i doing wrong?

Thanks in advance

Bertil Rebergen

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

I am not sure though.. Try this..

wdContext.current<node name>Element().modelObject().unRegister()...

Regards

Bharathwaj

Former Member
0 Kudos

Hi,

I decided to change the function module in a way that I can do a request to clear the Table which is part of the export parameters.

This works fine..

Thanks for all the help

Bertil

Former Member
0 Kudos

hi,

Is it mapped to some other node..If so may be that node is supplying the values as soon as u have invalidated

Regards

Bharathwaj

Former Member
0 Kudos

Hi

It should give you the same values because i guess

it is mapped to some other node.If so then that might be supplying the values as soon as u have invalidated.

Check this post.

Valery has given a very nice explanation on validation and invalidation.

regards

ravi

Former Member
0 Kudos

Hi,

I read the forum in which Valery explains the validation & invalidation.

The node I am using is an export parameter of a RFC. So according to Valery this means that if nodes get invalidated, elements will be supplied as related model objects of parent element model. This is a case with dynamic RFC output and / or tables.

So if I understand this correctly I have to do something else to clear this node.

Do I have to bind another context like:

wdContext.nodeA2().bind(new ....); and what happens with the old context? (carbadge collector?), or do i have to call the RFC to do it (i suppose not!)

or is there another alternative?

Thanks

Bertil

Former Member
0 Kudos

Hi

yes but you will have to do it with something like

wdContext.nodeOutput().bind(new Bapi_output());

Just doing a invalidate() will not clear the old context data in your case. This will clear the old context data. But what is it that you are trying.

I found that if you invalidate the main model input then your data is cleared.

wdContext.nodeBapi_Input.invalidate();

regards

ravi

Former Member
0 Kudos

Hi

I am using a WebDynpro application which shows rows using a grid. The rows are retrieved by calling a RFC.

At some point i just want to clear the grid. So i thought it would be posible to invalidate the node that holds the rows that are shown in the grid.

I think your solution proposal is a suitable solution. The only thing that is not clear to me is what happens with the 'old' context. Will it be collected by the garbadge collector or is there a nice way to remove this context.

Bertil

Former Member
0 Kudos

Hi

But to get the back the data after you invalidate the node you need to have some method call which will execute the model again to get the data.

regards

ravi

Former Member
0 Kudos

Hi,

I think I should add something here.

The node you are using might be a model node. A model node does not store value but is a reference to the model object.

An invalidation is a re determination of the value in a particular mode. Hence as your context model node in the contrller is bound to the model executable object, every time you invalidate the Output node refer to the model reponse object.

I think this might be the reason.

Regards

Noufal