Particular page creation assistance

Hey guys,

Basically just wondering if this is possible:

I wanted to create a page on my wiki that has a table at the top with numerical values people can fill out, and during the wiki page, it’d take those values and fill them out further down.

E.g.
User puts in values for A and B (let’s say 12. and 28).
Later in the article, it’d have something like:

“Calculation for Blah is: [A] divided by [B] multiplied by number of people in the room” where the numbers for A and B automatically get put within the sentence.

Is this possible? Have I made any sense?

Thanks!

Hi,

Option 1

you can create structures in xwiki (we call it XClass and XObject). XClass is the structure definition and XObject an instance of that structure in a given page.

So you can create an XClass with 2 numeric fields (for A and B).

then in the doc you can use:

{{velocity}}
$doc.getValue('A') divided by $doc.getValue('B) ....
....
{{/velocity}}

Don’t know if that fills your need. You can check:

Option 2

Use the page’s AST to access content and do some stuff with it.

See https://rendering.xwiki.org/xwiki/bin/view/Main/WebHome

For example

|= Col1 |= Col2
| value1 | value2

Someting...

The value of {{velocity}}$doc.xdom.getBlocks(....){{/velocity}} multiplied by {{velocity}}$doc.xdom.getBlocks(....){{/velocity}} .....
1 Like