felix571
felix571

Reputation: 9

Check dataset after "next" dataset

I´ve got a problem with comparing consecutive lines in crystal reports. Here is my scenario, I´ve got the following datasets:

Dataset Positionnumber Positiontext
1 100 Text100
2 105 Text105
3 150 Text150

It is possible to just have the case with only Dataset 1, Dataset 1 & 2 or Dataset 1 & 2 & 3. If there is more then one dataset available I want to read out the highest dataset. The other datasets are not used then.

Example 1:

Dataset Positionnumber Positiontext
1 100 Text100
2 105 Text105

--> Read out Dataset 2

Example 2:

Dataset Positionnumber Positiontext
1 100 Text100
2 105 Text105
3 150 Text150

--> Read out Dataset 3

I already tried the "next"-function but that only helps with looking for Dataset 2, I can´t reach and compare Dataset 3:

if {Z_QM_INFOSET_CR.VIQMFE-POSNR} < next ({Z_QM_INFOSET_CR.VIQMFE-POSNR}) then next({Z_QM_INFOSET_CR.VIQMFE-BAUTL})

else {Z_QM_INFOSET_CR.VIQMFE-BAUTL}

I hope my problem gets clear and you guys can help me out. Thanks in advance!

Upvotes: 0

Views: 38

Answers (1)

mweber
mweber

Reputation: 688

If you want to only show the newest line, you could sort in descending order by "Dataset" and hide all lines that do not have a LineNum = 1.

Upvotes: 0

Related Questions