Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2004

    Unanswered: SQL in a CR Formula


    Just started with Crystal and the report I'm amending needs some data from tables which are not part of the main report (overtime for each employee listed).

    I think I need to set up a formula to get the data from the other tables but I'm a little confused about how to do this as there seems to be several options. I'm OK writing SQL but I can't work out if this is the best option and the exact syntax.

    My first efforts at using a crystal formula saw the number of lines on the report change. Is it possible to define a variable in a formula and then store values in it before returning a value to the report. Excuse my syntax I'm new to Crystal and the below is based on the sql I'd use to do this with my ERP reporting tool ie.

    long m_over

    select * from overtimetable


    m_over = m_over + overtimevalue



  2. #2
    Join Date
    Jun 2005
    I'm not an expert myself (as you can see by my past qustions in this forum!), but what I'd do, assuming the data in your mainreport is in one table, and the data for the overtime is in another table, is go to Database => Database Expert in the menu, and add your overtime table, and link it to the main table using whatever key is common between them.

    Once that's done, go to View => Field Explorer to bring that up (there's probably other ways, this is how I do it) and right-click on "Formula Fields" and choose new.

    You're popped into a screen where you have your report fields, functions, and operators, and you can enter your formula. Once you save and close, it'll appear in the Field Explorer as something you can drag and drop into the details section of your report.

    I hope that helps.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts