cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Formatting Boolean value in a RTF descriptor

ingriva
Contributor

Hi.

In RFT descriptor I like to change the output of a Boolean attribute in

"X" if the value is 1

" " if the value is 0

 

Instead of 1 an 0 I like to see “X” and blank.” ”

 

Some Ideas?

Thanks.

8 Replies

ingriva
Contributor

Working solution:

  • Bookmark on the table
  • A VB macro in document template
  • Macro   Sub AutoOpen()
  • After document is open I find the bookmark, and I check each table cell
  • If 1 I can change the value to X else if 0 I can change the value to “ “

It’s not the best but it work Smiley Happy

 

Thanks everybody for help and suggestions.

Marco,

 

The best solution would be, indeed, to create the whole table via a macro.

 

But if you do not want to bother with this, another solution would be to use a "trick"  Smiley Wink

In your descriptor, when you add your field in the table, just add a specific string just before it (like "xxx").

And then, when the document is generated, just search/replace "xxx1" by "X" and "xxx0" by "".

You can also create a very simple word macro to automate this (but this macro still will need to be ran manually...)

 

Regards,

 

Lionel

 

Note that RTF macros require MS Word at runtime

As a consequence, they are not supported when report template (MS Word) are converted to RTF format.

This conversion is required to generated report (MS Word) from Web Front-End.

http://community.mega.com/t5/custom/page/page-id/mega-kb-solution?sid=50120000000mr0sAAA

 

 

Jerome

If you want this, you need to go for the first possible solution that you suggest, namely implement the table through a VBscript macro. At least that is the one I know that will work and give you the desired result. 

ingriva
Contributor

Thanks everybody for ideas, but my case is more complex (as in this picture).

FormattingBoolean.png

Possibile solutions under investigation:

  • Create full table via Macro VB
  • Create some Global variables, set this variable and use this global variables in descriptor (I don’t know if this is possible)
  • Define 10 new MetaAttributes and set the Text value befor starting report generation (I don’t know if this is possible)
  • Crazy solution: create a group for each possible combination Man Sad

imranusman
Super Contributor

If you are a code savy you could always use a simple macro.

lionel
MEGA
MEGA

Hello Marco,

 

As Jérôme said, it is easier to use string attributes.
But if you do not want to create a new MetaAttribute, and really need your X in place of 1, you can do it, but it's a quite heavy solution.
Let me explain with the "Detailed Sepcification" boolean metaAttribute on the "Application" metaclass.
You need to create 2 specific groups under your application group, one in case the boolean attribute is "True" (i.e. checked), one in the other case.
Then, in each group, you will "hard code" the value of your metaAttrite, using "X" in case it's true, and blank otherwise 🙂

 

Boolean Attribute.jpg

jhorber
MEGA
MEGA

I am not aware of such feature.

 

I general, a good practice is to implement boolean properties as MetaAttribute of type 'String' and format 'Enumeration'

You can create 2 MetaAttribute values

Ex:

  • Internal value 'Y' , external value = 'Yes'
  • Internal value 'N' , external value = 'No'

This is much easier to document

Jerome