Search code examples
algorithmjasper-reports

How to make data to show in separate word instead of one word from XML in jaspersoft adhoc


I have a lookup table that is harvested from the XML file and not physically stored in the MySQL database. Because of that all the data are represented in one word when it is queried out using jasper adhoc for example

  1. ridikill
  2. peon
  3. thegreat

All these lookup should be like so

  1. ridi kill
  2. pe on
  3. the great

how to make the data to show correctly in separate words.


Solution

  • You are going to have some trouble doing this exclusively in the Ad-Hoc editor, it simply doesn't have this kind of functionality on it's own. You could create a calculated field with the following code in the formula builder:

    CaseWhen("RigType" == 'deepwaterdrillship', 'deep water drill ship', "RigType" == 'standardjackup', 'Standard Jack Up',"RigType"=='standardfloater','Standard Floater')
    

    Replace all instances of "RigType" with your original field name. Obviously this will get quite manual if you have a lot of different strings.

    If you created a calculated table in the domain/topic that you are using, with similar logic to the code above, this would be more powerful since you can join to your other tables. However, as Petter commented, this is a data source problem and in my experience it is always better to fix the source if possible.