cancel
Showing results for 
Search instead for 
Did you mean: 

Sequence of parameter values

Former Member
0 Kudos

Hi There,

I am a newbie to the Crystal arena, so please pardon if my questions are too basic in nature. In the report that I am trying to prepare, I want user to input various carton numbers, for which certain fields are required. Now, I want to assign a sequence number to each of those entries. I should be able to get the sequence number for each carton in the way it was entered. For example:

If the carton numbers that user enters are AAA, BBB and CCC in that sequence; I should be able to get 1 for AAA, 2 for BBB, and 3 for CCC. If the user provides a different sequence like AAA, CCC and BBB, the sequence number should change accordingly. Also, the total number cartons that a user can enter is not limited.

Is there any way this is possible in Crystal?

Please let me know if I am making sense of my question here.

Thanks for helping!

~Himanshu

Accepted Solutions (1)

Accepted Solutions (1)

Rafaee_Mustafa
Active Contributor
0 Kudos

Hi Himanshu,

You can get the value from the sequence of your parameter If you have set parameter accordingly

Para1, Para2, Para3 What ever values they give you have in sequence.

If you want how user enters the Parameters like Para1 first then Para3 comebacks to Para2

you cannot catch that sequence

For this you need to ask user on which sequence he\she gonna enter

Make new parameter with sequence give him the drop down values A-B-C, A-C-B, .... 2^3 = 8 combinations

so what ever sequence he selects make your case accordingly!!

Regards,

Rafaee M

Former Member
0 Kudos

Hi Mustafa,

Sorry for confusing you. The total number of carton numbers that a user can input is not fixed. Crystal should dynamically allocate a sequence number to all the cartons that user enters in a particular sequence.

For example

Actual Carton numbersCrystal generated sequence#
AAA1
BBB2
CCC3
DDD4
EEE5
FFF6
GGG7
HHH8
III9
JJJ10
III11
KKK12

Again, the total number of carton that a user can enter is not fixed, so this can continue further as per user entry.

Let me know if I am making sense.

Thanks for taking time!

~Himanshu

abhilash_kumar
Active Contributor
0 Kudos

Hi Himanshu,

Try this please:

1) Insert a Group on the 'Carton Number' field

2) Create a formula with this code:

WhileReadingRecords;

numbervar i;

local numbervar j;

stringvar array arr := {?Carton_Prompt};

for i := 1 to ubound(arr) do

(

    If {Carton_Field} = arr[i] then

    (

       j := i;

    );

);

j


3) Go to Insert Summary > Choose this formula field as the 'Field to Summarize' > Choose "Maximum" as the Summary Operation > Under 'Summary Location', choose the Carton Group > Click OK


4) Next, go to Group Sort Expert > Choose 'All under 'For this Group Sort' > Under 'Based on', choose the 'Max of @formula' summary field > select the sort order as 'Ascending' > Click OK.


Hope this helps.


-Abhilash

Rafaee_Mustafa
Active Contributor
0 Kudos

Hi Himanshu,

I wonder how you create your query with dynamic request of cartons (3 or 1 or 10). How did you filter your records ??

If you wanna make Crystal Parameters you need to define before the generation of report. CR cannot create Parameters on fly.

One thing may be you can do, take input with comma separated values and break them.

AAA,ZZZ,TTT,KK

I dont thing I'm making any sense 

Former Member
0 Kudos

Bull's eye. Dude this is phenomenal !

Thank you very much for helping out.

Former Member
0 Kudos

Hey Mustafa,

Refer to Abhilash's answer above. He's the man of the hour!

Thanks for taking time to help buddy.

~Himanshu

Rafaee_Mustafa
Active Contributor
0 Kudos

is champ he also answered lot of my questions

raghavendra_hullur
Active Contributor
0 Kudos

Good One Abhilash, that was real quick solution.

Thanks,

Raghavendra

ido_millet
Active Contributor
0 Kudos

Hi Abhilash,

To improve performance, consider adding after the j := i;
Exit For ;

You can see the logic at an FAQ I wrote about this here:

Sort Report in the Order of Multi_Valued Parameters …

abhilash_kumar
Active Contributor
0 Kudos

Very Similar approach there ehh, Ido!

I have never used 'Exit For' before however, I can clearly see how that could improve the performance - Excellent!

-Abhilash

Answers (1)

Answers (1)

raghavendra_hullur
Active Contributor
0 Kudos

Hi,

Can you explain on below points to understand your requirement?

1. Which version of Crystal Reports you are using?

2. The parameter for carton, is it a multi value parameter (Means whether it accepts more then one value at a time)? If so, are you using/planning to use any static values for AAA, BBB etc? Please explain more on this parameter.

3. Say user enters AAA, CCC and BBB then are you looking for sequence values like 1,3,2 (assuming you assign 1,2 3 respectively for AAA, BBB and CCC)?

Thanks,

Raghavendra

Former Member
0 Kudos

Hi Raghvendra,

Thanks for taking time for answering. Sorry if I did not explain my requirement completely. Here are my responses:

1. I am using Crystal 9

2. Yes, Carton is a multi value parameter. I am not trying to use any static value for carton numbers; I am not restricting the total number of carton values entered by user and thus dont plan to use any static values.

3. User can enter carton numbers in any sequence. Crystal report should dynamically allocate a sequence number as per the sequence of the entries received.

Am I asking for too much? Please let me know if you still have any questions.

Thanks,

~Himanshu