cancel
Showing results for 
Search instead for 
Did you mean: 

How to determine if data in model has been retrieved once

Former Member
0 Kudos

Hi,

I want to retrieve and populate my model node data only one time per employee session.

I can't seem to figure out how to determine if the model node has been populated once or not. I tried inspecting the size of the node. I tried the isEmpty() method. I tried checking for null value. I also manipulated the cardinality of my node without success.

1. What is the correct program code to determine if a node has been populated once already (via a call to an SAP function module)?

2. Is the correct cardinality of the node "0..1"?

3. A refresh of the browser shouldn't invalidate the model data, should it?

Thanks much!

Kevin

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Kevin,

1. You may check the size of the node or do as suggested by Arun.

2. Cardinality (n:m) describes the foreign key relationship with regard to the number of possible dependent records or referenced records. Refer <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/d7/e551cf896c3a49bb87bb4ce38c99c8/frameset.htm">Cardinality</a> for further understanding. So, manipulating cardinality is not the right way for this problem.

3. A browser refresh is as good as calling the deployed application again. So the fresh data will be fetched.i.e,RFC will be executed again.

Bala

Former Member
0 Kudos

Hi Bala,

1. I tried checking the size of the node, but wasn't able to get it to work. Do you have sample code showing how this is done? Is there help documentation somewhere explaing this method?

2. How do you control the length of time that the data is kept?

Kevin

Former Member
0 Kudos

Hi,

Would it be easier to add a boolean flag to your context that is set to true once the data has been retrieved. You would set it to false in the wdDoInit of the component controller.

Then you just need to check the flag at the point in your code where you are going to read the data - hopefully this way it will be read once when the application is first started but not again.

Hope this helps,

Gareth.

Answers (2)

Answers (2)

siarhei_pisarenka3
Active Contributor
0 Kudos

Hi Kevin

1. Method IWDNode.validate() returns TRUE and calls supplyXXX(...) if the node had invalidated state before (empty state). The method returns FALSE and does nothing in case the node had been already supplied (has a valid state).

BR

Sergei

former_member85655
Active Participant
0 Kudos

Hi Kevin,

You can probably set a flag in your supply function to true ,once you have entered it. Entering the supply function guarantees that the data has been populated. Hope this helps.

Regards,

Arun