Number

Hi there pips please help

I have a report that show the First and Ending number,so what i want is to check that in that range if there is a number that is missing,for instance 1 to 10 then if 6 is not there i want to displa a message saying the number is missing,please help with the code.The first and last number are variables.

Thanks in Advance!!

It seems is a simple comparison.

Use the OnAfterGetRecord trigger of the report’s data item and write something like this:

If fieldName = 6 then message(‘messageText’);

Note that the message will be displayed when the report is finished… if you want to show that missing numbers on the report use a control on the report. Hope it helps :slight_smile:

Hi.

Did the previous post help you to resolve your problem? It’s just I dont quite understand what you are asking here.

If this hasn’t been resolved, please explain a little more (and if possible, show some dummy data).

What i mean is you have this customer (e.g. CUST0001 to CUST9999),and i want to see if there is a number which is missing or not there when we create customer for instance (Cust002) is deleted or skipped then i want to see those ones that are missing! thanks again for the reply!!

I tried to use INCSTR(Myvariable),but i have’nt tested yet!

So the previous response to your question would work.

IF {variable} <> {previous variable} + 1 THEN

MissingNumber := {previous variable} + 1;

Then show MissingNumber variable in a control on the section of a report.

Hope this helps.

Thanks i tried the same one as this one,it find the missing one,but it finds only one and i’ll try and put it in the loop( DO WHILE)

Thanks a lot!!

I’m afraid you have a little mess or I didn’t understand your explanation siya10.

You don’t need a DoWhile structure… using a report, the AfterGetRecord trigger works like “DoWhile”, so you will get an iteration for each customer (if we are taking about Customer table). You just need a global var to store all missing values and show them either with a control or with a message.

I thank you talked about a fixed value to compare (like “6” in the example), but if you want to check a sequence (Customer.“No.” for example), the comparison would be something like this:

IF Customer.“No.” <> INCSTR(xRec.Customer.“No.”) THEN missedValues := missedValues + ", " + INCSTR(xRec.Customer.“No.”);

You just have to display a MESSAGE(missedValues) on OnPostDataPort trigger. Better?

Thanks a lot for the replies!!! I’ve created an Integer DataItem and i used this code!! and its working very well[Y]

SETRANGE(“Missing Cr. Memo”.Number,vStartCrMemo,vEndCrMemo);
“vCountCr.memo” := FORMAT(Number);
IF rSalesHeader.GET(rSalesHeader.“Document Type”::“Credit Memo”,“vCountCr.memo”) THEN
vPrint := FALSE
ELSE
vPrint := TRUE;