Consultor Eletrônico



Kbase P95587: How to view one element from a Progress array field in Crystal Reports?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   15/10/2008
Status: Verified

GOAL:

How to view one element from a Progress array field in Crystal Reports?

GOAL:

Is it possible to extract and display a single element from a Progress array field in Crystal Reports?

GOAL:

How to use the PRO_ELEMENT function in Crystal Reports

FACT(s) (Environment):

Crystal Reports 9
Crystal Reports 10

FIX:

This can be done in 2 ways:

1) Use the PRO_ELEMENT function to select the required element(s) from the array. This can be done either via a SQL Expression created within the report or a Command (custom SQL statement). Using a SQL Expression is the better option as not only will the SQL Expression be processed on the server (since the Expression will be added to SQL statement generated by Crystal Reports) but it can be accessed in the report designer interface. For example, the following statement created as a SQL Expression will display only the second element from the MonthQuota array field:

PRO_ELEMENT(MonthQuota,2,2)

PRO_ELEMENT(<array_style_expression>,<start_position>,<end_position>)


2) Use a Formula in the report to extract the desired element(s) from the array field.
For example, the following Formula will return only the first element from the MonthQuota array field:

SPLIT({Salesrep.MonthQuota}, ";")[1]

SPLIT(<array field>, "<delimiter>")[<element-number>]

The SPLIT function takes a delimited string and creates a VB-style array. It is then possible to select any element from the array field. Please note however that Formulas are processed on the client-side.