Leave feedback
  • Question

    The ordere of RTF paragraphs and Data in StoryTeller

Enter a new topic
  • Hidde Husman Hidde Husman
    0 likes 4272 views

    I have RTF files containing paragraphs.

    I have Data from my business application that needs to  be presented in a tables.

    I have a table containing the order of the Paragraphs and Data tables based on a field in the data.

     

    I'm able to read the table, I'm able to get the RTF files into the document (in the right order), I'm able to create the tables. So far so good.

    But,

    I cann't find out how to get the Paragraphs and tables in the specified order.
    Like:

    Document 1
    Paragraph A
    Table 1
    Paragraph B
    Paragraph C
    Table 2

    Document 2
    Paragraph A
    Paragraph C
    Table 1
    Paragraph D

    I tried to connect a Switch Case to a Repeater, seems not possible
    I tried to interupt a Repeater, but I cann't get it to continue
    I tried a script with a switch case and call or link a story, but there seems to be no scripting variant of the build in switch case. linking a story.

     

     

     

     

    Friday 12 February, 2010
  • Vyv Lomax Vyv Lomax Administrator
    0 likes

    Hi there - I think that this is an excellent question - we should try to get to the bottom of this.

    Story Teller is a new product to many here so we should try to find the best way to perform your design request.

    When you write "I have a table containing the order of the Paragraphs and Data tables based on a field in the data." Do you mean a look-up table? Does this change dynamically?

    Are you using any any Stories or just plain tables?

    Can you make any assumptions as to the maximum number of paragraphs? Create placeholder arrays?

    Story Teller is design driven (not data driven) and your design is coming in from a look-up table so I would suggest that you try creating a series of objects on your page that are identified and populated from your look-up table. Something like:

    Create a Story Frame

    Create a Story

    Crate 5 rtf file links (all with a modification - modification value comes from your table)

    Create 5 tables (create all tables that are possible required - call for correct table from your look-up table)

    Crate 5 rtf file links (all with a modification - modification value comes from your table)

    Create 5 tables (create all tables that are possible required - call for correct table from your look-up table)

    and so on.

    This is just a suggestion and I realy hope that you get som other (probably more qualified) suggestions too.

    Friday 12 February, 2010
  • David Bares David Bares OpenText Employee Administrator StreamServe Employee
    1 likes

    Hi

    Without more info I assume that you read the order of your components into some variable array.
    Then you put this array into a repeater.
    Then you create inner "handling" repeaters, something like:
    self::*[starts-with(., "Table")]
    self::*[starts-with(., "Paragraph")]
    The content of a handing repeater is what needs to be done with particular type of component.
    You can have that in repeater directly, or you can use story reference

    Same can be achieved with a switch inside the array repeater.
    The switch expression would be substring-before(.," ")
    case "Paragraph"
    case "Table"

    There are differences between switch and repeater approaches. Switch shows only one case at a time in design time. For repeater each handling XPath is evaluated. I think the decision is case by case and perhaps also personal inclination.

    Friday 12 February, 2010
  • Hidde Husman Hidde Husman
    0 likes

    Hi,

    Thanks for your swift replies.

    I'm looking fotr the most easiest way of doing this. If needed I will put the order of the paragraphs in the input XML. (as elements, re-occuring, ..)

    David,

    • How can I get a 'Story reference' to a 'repeater'? as far as I can see a 'Story reference' is a 'root binding object' (same goes for 'switch case').
    • What do you mean with 'inner handling repeaters'?
      Can I store an array inside one element and let XPath repeat within the array?

    Thanks

    Hidde

     

     

    Friday 12 February, 2010
  • David Bares David Bares OpenText Employee Administrator StreamServe Employee
    0 likes

    Hi

    • How can I get a 'Story reference' to a 'repeater'? as far as I can see a 'Story reference' is a 'root binding object' (same goes for 'switch case').

    You create a new story and put your repeater there. Then you reference a story.

    • What do you mean with 'inner handling repeaters'?
      Can I store an array inside one element and let XPath repeat within the array?

    Perhaps I do not understand here.
    With repeater you can repeat
    1) blocks of your message (/data/message/my_block)
    2) elements of a variable array ($my_array)
    as a matter of fact you can repeat anything that returns a node-set

    So, to solve your case, you can either repeat blocks that are created from reoccurring xml elements
    or you can repeat an array if that is what holds the order. The array can be created from many different sources, usually through scripting.

    By inner repeater I mean repeater nested with higher level repeater.

    Repeat: /data/message/order
         Repeat: self::order[type="Paragraph"]
               subst(Name)
         Repeat: self::order[type="Table"]
               Table
               or StoryRef( myTable )
               or something else

    Hard to build something so vaguely defined data. You can try to describe the data in more detail and I can suggest the solution.

    Friday 12 February, 2010
  • Hidde Husman Hidde Husman
    0 likes

    Hi,

    I'm sorry about the vague defined data. I' can adapt the data to help me to get this working.
    For the data there are two options.
    - The Sequence of paragraphs in in the XML
    - The Sequence of paragraphs comes from a table.

    Your right when you say you can repeat a node-set.
    But I cannot seem to connect a 'Story reference' to a repeater. (or a 'switch case')

    So in your example:
    Repeat: /data/message/order
         Repeat: self::order[type="Paragraph"]
               subst(Name)
         Repeat: self::order[type="Table"]
               Table
               or StoryRef( myTable ) <---  I cannot get this to work in storyteller
               or something else

    Please take a look at the attached PDF.

    Monday 15 February, 2010

    Attached files

  • David Bares David Bares OpenText Employee Administrator StreamServe Employee
    1 likes

    Hi,

    Perhaps you can try it from the other side - from inside up if that is easier for you.
    The interface does not allow you to add to repeater or switch, but it allows you to select some content and create a repeater or switch around it.

    Assuming a structure of your XMLOUT:
    Prepare 2 stories: main and data.
    Create a frame for main story on a page
    Create a substitution into a main story.
    Click on a substitution to select it.
    In property grid change substitution type to Repository
    Change the sample data of substitution to Paragaph content comes here.
    Add a modificatin URI=paragraph_content.
    Right click on substitution on a sheet again and select Repeating/Repeat
    Set /letter/paragraph as a repeater XPath (in reality you need to use real message path)
    Right click on a substitution on a sheet again and select Insert/Switch
    Put paragraph_key as a switch XPath.
    Expand the switch and rename case to "content".
    Right click on case and select Switch/Add Case
    Name the new case "data"
    Go to property grid and change Story to data
    Select the data story in list of stories.
    Switch to story view
    Create some table into the story

    Now you should have a construction that formats rtf files for content paragraphs and calls a data story for data paragraphs in correct order.
    Next thing to do would be to handle the data in data story. Probably by creating another switch inside the data story, using paragraph_content. With cases like "table", "table2" etc.

    You have probably noticed that each case can have its own embedded content (default) or it can point to another story. You can use "Switch/Edit in story view" for editing the own content.
    Decision if you want to use more stories or code everything into one is up to your preference.

    good luck

    Tuesday 16 February, 2010

    Attached files

  • Hidde Husman Hidde Husman
    0 likes

    Thanks for the answer!

    The real problem seemed to be a difference in behavior of the "story view" (center screen) and the "stories window" (panel on the right).
    In the "story view" you are able to create a repeater on a "switch case". This is not possible on in the "stories view".

    My problem is solved.
    Hidde Huisman

    Tuesday 16 February, 2010
  • David Bares David Bares OpenText Employee Administrator StreamServe Employee
    1 likes

    The reason why functionality set in sheet view and tree view is different is that trees do not show all the content, they display only objects in the story. So from the tree you cannot create a repeater or switch around range of text. From sheet you can do everything.

    But based on your input I will ask developers to enable creation of repeater and switch form tree as well. It can still work for objects that you see.

    Wednesday 17 February, 2010
  • Stefan Cohen Stefan Cohen StreamServe Employee Administrator
    0 likes

    Hidde,

    I'm glad that your problem got solved.

    You have the possibility as a topic starter to mark an answer as "This answers my question". Please do so if a particluar reply provides you with the answer you where looking for or if it pointed you in the right direction. You even have the possibility to mark your own replies as best answer if you for example find the solution yourself.

    This will hopefully make it easier for others to find the most relevant information fast.

    Best regards,

    Stefan

    Wednesday 17 February, 2010