Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reporing a break in a number sequence 1

Status
Not open for further replies.

QueSpr04

Programmer
Jun 3, 2004
50
US
CR10
ODBC[RDO] connection

I am trying to get an asterisk to show where there is a break in the sequential order of numbers. I think I am heading down the right path by using a WHILEREADINGRECORDS statement, but cannot figure the rest of it out.

Example: 1 2 3 4 * 6 7 * 9 10 11 * 13

How can I get this to work? Please help!
 
If you only need one asterisk even if there is a gap greater than 1 then you can use the following:

if onfirstrecord then totext({table.number},0,"") else
if {table.number} <> previous({table.number}) + 1 then
"*" +chr(13) + totext({table.number},0,"") else totext({table.number},0,"")

You would then right click on this formula->format->field->common->check "Can grow."

-LB
 
Sorry I wasn't more descriptive of the matter. But to get more in detail, there is a series of number as such;

020103397 020103398 020103399 020103400 020103401
020103402 * 020103404 * 020103406

And as you can tell, there is a break in the sequence on the second row. The formula that was supplied thinks that it is text instead of a number. The field name for the data above is {cr_tdecals.decal}. If you can plug this field name into the formula, it would be great. Hope I clarified it a little better for you.
 
No, the formula that is supplied assumes that the field is a number, and it looks to me like your field is actually a string field. If it is a string field, then the formula should be:

if onfirstrecord then {cr_tdecals.decal} else
if val({cr_tdecals.decal}) <> val(previous({cr_tdecals.decal})) + 1 then
"*" +chr(13) + {cr_tdecals.decal} else
{cr_tdecals.decal}

This needs to be formatted it to "can grow".

From your other thread, I gather that you really want this to be a horizontal display, so then you would instead create two formulas:

//{@accum} for the detail section (to be suppressed):
whileprintingrecords;
stringvar x;

if onfirstrecord then
x := {cr_tdecals.decal} else
if val({cr_tdecals.decal}) = val(previous({cr_tdecals.decal})) + 1 then
x := x + " " + {cr_tdecals.decal} else
x := x + " * " + {cr_tdecals.decal};

//{@display} for the report footer:
whileprintingrecords;
stringvar x;

Format {@display} to "can grow" as well, just in case there is not enough space. If you want the display at a group level, then add a reset formula in the group header:

whileprintingrecords;
stringvar x := "";

-LB
 
THIS WORKS GREAT LBASS! BUT THERE ARE A COUPLE OF THINGS STILL GOING ON HERE. I USED THE FIRST FORMULA WHICH IS
if onfirstrecord then {cr_tdecals.decal} else
if val({cr_tdecals.decal}) <> val(previous({cr_tdecals.decal})) + 1 then
"*" +chr(13) + {cr_tdecals.decal} else
{cr_tdecals.decal}
IT DOES WHAT IT IS SUPPOSED TO DO, BUT IT STARTS EVERY GROUP OFF WITH AN ASTERISK. EXAMPLE, THE REPORT THAT I AM DOING IS GROUPED BY TELLER AND IT DISPLAYS THE DECAL NUMBERS THAT EACH TELLER ISSUES OUT. AND IF THERE IS A SEPERATION IN THE SEQUENCE IT DISPLAYS AN ASTERISK BETWEEN THE 2 NUMBERS. AN EXAMPLE LAYOUT OF THE REPORT IS AS SUCH WITH THE TELLER NUMBERS BEGINNING WITH MV.........

MV01
-------------------------------------------------------
010000000 010000002 010000003 010000004
010000005 * 010000007 *
000000009 000000010 010000011 0100000012

THIS IS THE FIRST PAGE OF THE REPORT BECASUE THE REPORT IS DESIGNED TO BEGIN A NEW PAGE FOR EVERY TELLER. THE NEXT PAGE WHICH CONSISTS OF THE DECALS FOR THE NEXT TELLER STARTS OF WITH AN ASTERISK AS SUCH...........

MV02
--------------------------------------------------------
* * * 000000002
000000003 000000004 000000005 000000006

AND IT IS DOING IT FOR EVERY GROUP THEREAFTER. IT IS EVEN LEAVING OUT SOME OF THE RECORDS THAT ARE SUPPOSED TO REPORT. DO I HAVE TO HAVE A RESET FORMULA TO CORRECT THIS MISTAKE?





 
Change the formula to:

if onfirstrecord or
{table.teller} <> previous({table.teller}) then {cr_tdecals.decal} else
if val({cr_tdecals.decal}) <> val(previous({cr_tdecals.decal})) + 1 then
"*" +chr(13) + {cr_tdecals.decal} else
{cr_tdecals.decal}

Substitute your group field for {table.teller}.

P.S. It's better not to use caps in your posts--it's hard to read, and it is generally interpreted as yelling. Thanks.

-LB

 
Sorry, I did'nt mean for it to go over that way. Caps was on becausae I usually code in caps. Sorry. Please forgive me?
 
lbass,
I'm getting close to what it is i'm needing. It is displaying asterisks consecutively in which it should not do. I've tried minipulating the formula but still can't get it to work.
 
I can't tell what's going on without sample results. Please show the values of the decal field for a couple of groups, along with the results you are getting. Did you remember to format the formula to "can grow"? Without this, you might only see a series of "*"s.

-LB
 
MV01<----------"This is the teller #"
-------------------------------------------------------
010000000 010000002 010000003 010000004<----"This is the decal#"
010000005 * 010000007 *
000000009 000000010 010000011 0100000012

This is the exact format of the report, and the way it looks in the program. I formatted the formula to "Can Grow" and it did'nt make a difference. It is still printing consecutive asterisks. This is the way it looks on my report...........

MV01<----------"This is the teller #"
-------------------------------------------------------
010000000 010000002 010000003 010000004<----"This is the decal#"
010000005 * * *
000000009 000000010 010000011 0100000012

And I need it to only put an asterisk if there is a break between consecutive numbers. If the numbers ran as such; (000000001 000000002 * 000000004 * 000000007 * 000000009), the asterisk would still seperate the numbers and pick up for the next string of numbers. Hope this helps. Thanks a million for everything so far!
 
I think the problem is that you are using my first formula, which was designed for a vertical display, but that you are then formatting your details section for multiple columns. Does it work if you remove the column formatting (you might save the report under a different name and try this). Otherwise, I would suggest using my second suggestion which does not require using multiple columns, but gives the appearance of multiple columns depending upon how you size the field. You would have to make the change to the accumulation formula as you did for the first suggestion so that it worked correctly on the change of group.

-LB
 
I saved the file under another name and another directory and removed the column formatting and tried using both the formulas under the new column format and it still gives me the same results.
 
I can't see what the problem is. Both formulas work when I test them here with similar scenarios. Are you suppressing any duplicates, either fields or detail rows? Please copy some actual data into the thread and also copy the actual formulas you are using into the thread.

-LB
 
if onfirstrecord or
({cr_tdecals.teller} <> previous({cr_tdecals.teller})) then {cr_tdecals.decal} else
if (val({cr_tdecals.decal}) <> val(previous({cr_tdecals.decal})) + 1) then
(" * " +chr(13) + {cr_tdecals.decal}) else
{cr_tdecals.decal}

This is the formula I am using. What does +chr(13) in the formula do?
 
It adds a return--that's why you need to format the formula with "can grow". Still need some actual sample data in order to trouble shoot this, and you also didn't answer re: suppression of duplicates or records.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top