App Within Minutes Velocity Script

Hi,
I am very new to Xwiki.
I am just trying to create one App Within Minutes application and I would like to achieve following:

  1. Get document name (entry name or title ) while viewing the app
  2. I have created a macro called “Page Listing by Tags”. Once I have a title from step 1, I want to change title string a bit … For e.g. SERVERD56. I want to replace that “D” with “X” in a variable. So after replacement, it will become SERVERX56.
  3. I want to feed that variable in macro I created so that it can list pages with that tag in my app within minute application.

Please let me know if it is unclear. In short, I want to read the document name, manipulate it a bit and then execute a macro that will list pages with that tag.

I tried executing that macro in just WYSIWYG editor code window but it throws me an error that nested macro are not allowed
image

Any help with this is really appreciated.
I am new to Xwiki and Java world and trying to learn as much as I can.

Thanks,
Andy