#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2004
    Posts
    85
    Rep Power
    10

    ROR and Crystal Report Viewer?


    I have written an application in ROR, and have now come to the reporting piece. Reports will be written in Crystal and I'm wondering if ROR will allow me to utilize the Crystal Reports Viewer. Has anyone had any experience with this? Any opinions or advice always appreciated!

    Thank you!
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,638
    Rep Power
    4247
    Crystal reports can be configured to read XML input and format it accordingly. Hence, you can use a rails handler to output your report data in XML format and that should allow crystal reports to read from it.
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2007
    Posts
    1
    Rep Power
    0

    ROR and Crystal Report Viewer


    Originally Posted by Scorpions4ever
    Crystal reports can be configured to read XML input and format it accordingly. Hence, you can use a rails handler to output your report data in XML format and that should allow crystal reports to read from it.
    My reports use xml schemas (xsd) and they get fed at runtime using .net dataset. I know this is possible in .net but how is it possible in ROR? How is the xml data fed to these reports in Ruby. Plus what about the report viewer?

    sumeet chadddha
  6. #4
  7. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,638
    Rep Power
    4247
    If you're using RoR, the part that gets the data should be a method in the model/ directory. For instance:
    Code:
    class MyData < ActiveRecord::Base
       def self.getmydata(key)
           find(:all, :conditions => ["field1 = ?", key])
       end
    end
    Then, your controller class would look something like this:
    Code:
    class mycontroller < ActionController
       def xml_output
           id = params[:id]
           @data = MyData.getmydata(id)
       end
    end
    and your view template for xml_output.rhtml could look something like this:
    Code:
    <data>
        <% for item in @data %>
        <item>
            <id><%= item.id %></id>
            <name><%= h(item.name) %></name>
            <desc><%= h(item.desc) %></desc>
        </item>
        <% end %>
    </data>
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo

IMN logo majestic logo threadwatch logo seochat tools logo