开发者

Iterate through data table in Crystal Report

How can i create function to iterate through datatable to read value from table

e.g

Function GetVal(integer id) //iterate here and match value fr开发者_Go百科om table using id return value;

and call this function on report field

i am using crystal report 11

any clues??


Option 1: Make your function (or equivalent SQL query) outside of Crystal and link to it like any other source. The practicality of this option depends on the details of your report.

Option 2: Crystal doesn't have a built-in Get() function that I can find. So, you'll have to get creative with subreports. For example, let say's say you want to get {TargetFld} from {LookupTable} based on {CriteriaFld}:

  1. Make a subreport. Use {LookupTable} for your data source.
  2. When entering subreport links, choose {CriteriaFld}.
  3. In your subreport, make a formula. Use it to create a Shared variable and set the value to whatever value you want to pass back to the main report.
  4. Position the subreport 1 section above the section where you need to use this value. (Otherwise it won't evaluate when you expect it to).
  5. Create the Shared variable in the main report.
  6. Use it as normal.

If you're not familiar with subreports or shared variables, I suggest first looking them up in the Crystal help files (F11). This will make alot more sense that way.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜