on 07-16-2008 11:11 AM
This relates to NW Mobile 7.1, development for PDAs, NWDS SP05 P01
In a view, I added an attribute to the context and marked it "calculated".
In its properties, I can see that there is a getter method assigned, but the stub with the UCA (user code area) is not generated in the java file. If I select "Goto Implementation F3" it is not there.
If I add it manually, it gets deleted on generation.
Bug or feature?
Cheers, Andre
Hi Andre,
the supply function is always called if you trigger the reload() method of the context node. In your case if you call:
wdContext.noderewe1_sc().nodegetSomeTypes().reload();
You should execute the query in the way you described it in your posting. The corresponding supply function should contain the statement:
node.bind(Collections.singleton(getSomeTypes));
If the supply functions was implemented in that way and getSomeTypes is the query object available as global variable in the context class this should do the job. Please let me know if you face any specific issue with this implementation.
Regards,
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Stefan,
yes, that is exactly what the rest of the code looks like.
Thanks for the explanation. Is there any documentation about this? I have not found any.
Your suggested solution already works for me
Cheers, Andre
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Stefan,
thank you for this excellent answer. It is good to know that a feature does not work and not that I am too stupid to use it correctly
But your answer rises a new question:
When is the supply function called? As far as I could see on during the initialization of the application and not every time I execute the query. The query I am using is called many times with changing parameters. I am setting the parameters in the method that is generated automatically.
Should I implement the fix, that you suggested, in this method?
/**
* Method [getTypesForCatMakeDistinct].
*/
public void getTypesForCatMakeDistinct() {
//@@begin getTypesForCatMakeDistinct()
TCurrentEquipElement equip = wdContext.nodeCurrentEquip().currentCurrentEquipElement();
getSomeTypes.setPiCategory( equip.getEquipCategory() );
getSomeTypes.setPiMake( equip.getEquipMake() );
getSomeTypes.execute();
wdContext.noderewe1_sc().nodegetSomeTypes().reload();
//@@end
}
Cheers, Andre
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Andre,
unfortunately, calculated attributes is an unsupported feature in 7.10 on PDA. In 7.11, it will be supported in the way you want to use it. Not sure if the following procedure could help in your case:
1) If you bound a DO node/DataStructure to the context, create an additional manual attribute
2) In your supply function for the context node, you can manually set the value for the additional attribute by calculating the value in the required way. You should loop over all the nodes you are going to bind to the context
These steps are a bit more complex during modeling time, but at least the result will be very similar to calculated attributes.
Regards,Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.