VishalMistry
22nd December 2017, 12:45
Hi,

NOTE : THIS IS FOR BAAN IVC4.

We have a simple item sales report, where at each item change, we want to display sum of amount, total no. of customers by item and total no. of sales orders by item.

The condition is, it should count unique customers & sales orders by item. One way is to put control break login in session script, but, I was wondering if there is any simple way of doing it ?

I have attached the output coming and desired output in Excel format.

Any hint would be highly appreciated.

Vishal

mark_h
22nd December 2017, 14:41
Well I typically put the breaks in on the report and then leave the layouts empty. Seems to me a lot easier than trying to track when then value changes in the report script to add to the count.

shah_bs
22nd December 2017, 22:52
This is one case where the powerful report writer will not cooperate, I think. You will have to make do with a small work-around programming. The following is just an idea you will have to adapt.

So, I will make following assumptions:
- You have the Program Script Source code
- And, in the program script your selection is sorted by customer/order

So, then you can try as follows:
- Define an extern field called p_count (or whatever make sense) in the program script as well as the report fields.
- In the program script, also define another field like p_prev_ordr
- Then make the count field zero or 1 according to the change of Customer and Order

* It is unlikely that the order number will be same for two different
* customers, so we can simplify as follows:
* Approximate code:
if p_prev_ordr = current_ordr
then
p_count = 0
else
p_count = 1
p_prev_ordr = current_ordr
endif

- In the report layout, on change of order number, count this new field.

srprks
26th December 2017, 07:04
Hi you can use a function on.change.check. below is the sample program from Pro guide.

string city(10)

city = "Paris"
on.change.check( city ) | checkpoint value set to Paris
city = "Rotterdam"
on.change.check( city ) | checkpoint value now set to Rotterdam
city = "Amsterdam"
if ( changed(city) ) then | changed() returns TRUE here, but also sets
| the new checkpoint value to "Amsterdam"
not.curr( city )
message( "City is changed, old city is: %s",city ) | city is Rotterdam
not.curr( city )
message( "New city is: %s",city ) | city is Amsterdam
endif
off.change.check(city)

Sahil Sharma
6th August 2018, 15:07
Just tick the option "Supress identical values" in "Conditions" Tab while adding a new report field.