cancel
Showing results for 
Search instead for 
Did you mean: 

Table visibility based on context - problem

Former Member
0 Kudos

Hi Experts,

I'm facing the following problem:

I have such a context in component controller:

CONTEXT [node]

-> MESSAGES [node] (0..n)

-> -> attributes of the message

-> messages_available [attribute, type = WDY_BOOLEAN].

For MESSAGES node there's a supply function defined - SFN_MESSAGES. It reads apropriate messages and set 'messages_available' attribute to 'X' if the number of messages read exeeds 0.

Then component controller context is mapped to the view context and MESSAGES node is bound to the table. Additionally the VISIBILE property of the table is bound to context attribute 'messages_available'.

I have the following requirement: table should be visible only when the number of entries in the MESSAGES node is 1 or more.

Actually it doesn't work.

I tried another approach - I don't bind VISIBILE property of the table with the 'messages_available'. Instead I read 'messages_available' context attribute in WDMODIFYVIEW method of the view controller and then I set manually the 'VISIBLE' property of the table.

Unfortunately second approach doesn't work neither, because WDDOMODIFY is invoked before SFN_MESSAGES (which in turn set appropriate value of 'messages_available' property).

Has anyone an idea how to solve that problem?

Best regards,

Adam Sas

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Your table propery Visibility is a single property with only 1 instance of that expected.

You have defined a node of cardinality ( 0..N ) and have your message_visible attribute there.

So there will be multiple instances of this node based on what data you fill within that node.

Plain solution:

Create a seperate Node - Table Properties cardinality ( 1..1 )

craete a visible attribute inside it.

Bind it to visibility prop of table.

Now read you node message and write a logic that if your node contains more than one messages set the attribute visibility of table properties node to true else false.

Hope you got an idea.

Regards

manas Dua

Answers (1)

Answers (1)

Former Member
0 Kudos

Dear Manas,

Thank you very much for a quick response. It helped a lot.

Basically I have followed your instructions and it's working.

But I would like to clear up few issues, mainly because I am not sure why it has started working. In my first post I simplified a little bit a description of the context.

The context structure at the beginnig was sth like this


CONTEXT
   ->RESULTS (node, 0..n)
      ->MESSAGES (node, 0..n)
      ->messages_available (attribute)

After some test I changed the structure of the context to the following:


CONTEXT
   ->RESULTS (node, 0..n)
      ->MESSAGES (node, 0..n)
      ->TABLE_PROPERTIES (node, 1..1)
         ->messages_available (attribute)

Could you explain why moving the 'messages_available' attribute to the node TABLE_PROPERTIES(1..1), which in fact is also a subnode of (0..n) node (i.e. RESULTS), has made this approach working?

Best regards,

Adam Sas

Edited by: AdamSas on Mar 11, 2010 5:28 PM

Former Member
0 Kudos

Hi,

Just see it at this way;

There is only 1 set of properties for a Table ( there can be only one caption, visiblity, etc etc ).

So when we created a new node of cardinality ( 1.. 1) so it exactly mapped there.

1..1 means that there is only 1 element of that node is permitted and that is created by default.

where as table data may contain 0 or more than one that is N rows so we assign the node node of cardinality 0..N to table data.

I hope its clear

For a better design I would advice that to manipulate all UI elements properties you create a seperate higher level node

say UI_DESIGN with card 1..1 and then create attributes within it and bind it to variuos UI element properties.

Manas

Edited by: Manas Dua on Mar 11, 2010 11:22 PM

Former Member
0 Kudos

Hi,

That's perfectly clear.

Thank you for your answers and tips.

Best regards,

Adam Sas