简体   繁体   中英

How Can I get the value from one TextObject and use it in another TextObject in Crystal Reports?

I am working on a legacy application (VS2005, C# 2.0, and Crystal Reports 11.5). I have to add a couple of new reports that get printed directly so the viewer doesn't come into play. If that's not enough, they need to be localized into 7 languages in addition to English.

I came up with a method to localize headings and labels that works well in this situation. The problem stems from the fact that some of the value fields in the report need to be displayed as strings based on the integer value in the data set. There are already formulas in the report to do this conversion, but they carry only the English translations. The on-screen displays are localized so I have to do the same with the printed reports.

What I would like to do is to add text objects to the report that would contain the localized values that need to be displayed. Is there a way for a formula in one text object to access the value in another text object?

The existing formula looks like this:

Switch ({Calibrations.Status} = 1, "No Calibration",
        {Calibrations.Status} = 2, "Running",
        {Calibrations.Status} = 3, "Active" )

I want it to look like this:

Switch ({Calibrations.Status} = 1, HiddenTextObject1.Text,
        {Calibrations.Status} = 2, HiddenTextObject2.Text,
        {Calibrations.Status} = 3, HiddenTextObject3.Text )

I haven't been able to figure out how to make this reference work.

Has anybody done this?

Thanks very much, Gary

It turned out a bit simpler than I expected. I added parameter fields that contain the localized text. Then, in my formulas, I return the values from the parameter fields.

That was almost too easy.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM