Counter going haywire

Hello all,
When one thing starts to work something from somewhere pops up and messes things. That is the same thing happening with me, however, I will not give up specially coming this far.
Anyhow, the current senario
I have created a report which uses crosstabs and a formula to work out number of days each job has taken to complete. This was working fine until I introduced a new parameter from another table.
The two tables in question are Order Header and Order Lines. Both are Inner joined (linked) with each other and Order Numbers field is unique between both of them.
The formula I am using counts the number of working days (exclude weekends and holidays). Using a crosstab it allowed me to use the same formula to count number of jobs each day (simply by putting the same formula into the summarized field of crosstabs), however, now the problem arises when I introduced a new parameter to filter number of orders.
The strange thing is that the number of orders shown in the report (individual orders:1657894) are correct however, the counter which counts them counts twice. For example:
Day 1 - Order 1, the report when counts shows Number of Orders = 2 (Order Number shown onto the report is however 1).
Day - Order - Jobs
1    - 165272 - 2
Though there is only 1 order number shown the stupid report shows total jobs as 2. This means it is counting total orders twice? or maybe it is placing 2 orders one from each table.
I checked using SQL under my old system to see if it produces 2 results but no, the old system prints only 1 record.
I checked the SQL command using (Show SQL) under Crystal and it seems that the SQL command is correct.
Funny enough the top header, Total Jobs were printed wrong as well until I changed the Total Jobs to Distinct Count from Count.
At this stage I think I need a separate formula which counts the number of Unique orders from both tables and shows it onto the report according to the parameters entered.
Here is the layout of the report. PLEASE CHECK MY IMAGE LINKS TO GET BETTER IDEA OF THE REPORT LAYOUT AND TABLE LINKS!
Page Header
Start Date: - End Date: -
Cstomer Account Number: - Product Group: -
Total Jobs: - Canceled Jobs: -
Still in lab: -  Credit Jobs: -
Report Footer
Crosstab  - Contains the formula which will be given below
Crosstab Row - Formula
Crosstab Summarized Field: Count of Formula
Can someone please help me creating a separate formula which I can use as a Shared var from the date formula so that the both formulas work together?.
//Parameter Code (Record Selection)
//The order header date entered is under Order Header table. The
//Account number is under Order Header table however, the
//Product Group is under Order lines table. The Order lines and
//Order header is linked (Inner Link) with each other on Order
//Numbers. Taking five digits from Order Lines Stock Code so that
//it is easier to display on the report and easier to input by end
//user.
//All the parameters here are set to static.
{order_header.date_entered} >= {?Start Date} and
{order_header.date_entered} <= {?End Date} and
(not HasValue({?Account Number}) or {order_header.account_no}
= {?Account Number})and
(not HasValue({?Product Group}) or {order_lines.stock_code}[1 to
5] = {?Product Group});
//End of Code
//This is a Formula which is used under crosstab. The normal
//formula is entered into the row section - Summarized field
//contains the Count(Formula)
WhileprintingRecords;
Local DateVar Start := {order_header.date_entered};   // Starting
Date
Local DateVar End := {order_header.act_despatch};  // Ending
Date
Local NumberVar Weeks; // Number of weeks
Local NumberVar Days; // Number of days
Local Numbervar Hol:=0; //Number of holidays
Shared DateVar Array Holidays; // Bank holidays dates array
Weeks:=(Truncate(End - dayofweek(End) + 1 - (Start -
dayofweek(Start) + 1))/7)*5;
Days:=DayOfWeek(end) - Dayofweek(Start) + 1
+ (if dayofweek(start) = 1 then -1 else 0) //adjust for starting on
sunday:
+(if dayofweek(end) = 7 then -1 else 0); //adjust for ending on a
saturday:
//Check for bank holidays
Local NumberVar i;
For i := 1 to Count (Holidays)
do (if DayOfWeek (Holidays<i>) in 2 to 6 and
Holidays<i> in Start to End then Hol:=Hol+1 );
Weeks + Days - Hol;
//End of Code
//SQL Command Code
//This is SQL command Code which is generated while running
//the report. The report is using 4 parameters at this stage. Start
//Date, End Date, Account Number and Product Group. You can
//see the criteria set in the code below.
SELECT order_header.order_no, order_header.order_status,
order_header.date_entered, ndmas.ndm_name,
order_header.account_no, order_progress.order_status,
order_progress.date_created, order_lines.stock_code
FROM   maxmast.ndmas ndmas, maxmast.order_header
order_header, maxmast.order_lines order_lines,
maxmast.order_progress order_progress, maxmast.slcust slcust
WHERE  (order_header.order_no=order_lines.order_no) AND
((order_header.order_no=order_progress.order_no) AND
(order_header.repeat_no=order_progress.repeat_no)) AND
(order_header.account_no=slcust.slm_custcode) AND
(ndmas.ndm_ndcode=slcust.slm_custcode) AND
(order_header.date_entered>={ts '2008-06-01 00:00:00'} AND
order_header.date_entered<={ts '2008-06-30 00:00:00'}) AND
order_header.account_no='0113158' AND
order_lines.stock_code>='7-889'
//End of Code
SCREENSHOTS
Database tables with links
[http://i46.photobucket.com/albums/f115/jaytheguru/DBtable.jpg]
Output on report example
[http://i46.photobucket.com/albums/f115/jaytheguru/counterhaywire.jpg]
Raw Report layout
[http://i46.photobucket.com/albums/f115/jaytheguru/rawreport.jpg]
Hope this explains everything.
Regards
Jehanzeb

Morning Jason,
I don't think I need the second formula as Crosstab provides the feature of distinct count anyway.
I have tried the formula you gave me however, that makes the total count + 1. Meaning,
Report:
Day 0 - 1
Day 2 - 1
Day 3 - 4
Total = 6
That is not correct,
I re-edited the formula but it doesn't seem to make that 0 going away.
Meaning
Report:
Day 0 - 5
Day 2 - 1
Day 3 - 4
Total = 5
This is correct.
Although the numbers are correct with correct days, for some reason it is still bringing up that 0 days on the top with total working days.
Formula I re-edited it like this
GTE_77
if ({order_header.order_status}>=77) = true then
{order_header.order_no}
also the following formula does the same thing
DistinctCount({order_header.order_no})
-(if ({order_progress.order_status}<>77) then {order_header.order_no});
Then used it under Crosstab Summarized filed as Distinct Count.
It shows the right information though 0 days are still coming up with total number of jobs.
It's strange that it is coming up even though I selected an option "Suppress if row/column empty". I guess it is not empty - it's filled with 0.
any other ideas I can try to make the formula count only those orders which are 77?
Regards
Jehanzeb
Edited by: Jehanzeb Navid on Aug 7, 2008 3:20 PM
I have seen that the Number of days and Number of Jobs with percentages are correct however, the Grand total of the row (Number of Jobs) comes to Total Jobs (23559) instead of coming to Number of jobs (23009).
I counted the jobs and they count up to 23009 and not 23559. It is strange to me why it is showing Grand Total of 23559 though it is counting each record correctly.
Edited by: Jehanzeb Navid on Aug 7, 2008 3:36 PM
Here is the screenshot which can explain it bit clearer
[http://i46.photobucket.com/albums/f115/jaytheguru/weirdtotal.jpg]
[http://i46.photobucket.com/albums/f115/jaytheguru/weirdtotal2.jpg]

Similar Messages

  • Touchscreen goes haywire every few minutes on Model 15-n071nr

    it seems to be happenin more and more often. When I use my laptop the toucscreen becomes unresponsive or does things as if someone is touchhing it however i never actually use the toucscreen, only the mouse and keybpoard. 
    There will be rather lare quarter sized dots going vertically along the same spot to the right of the midline of the screen as if someone is touchin it there. I have to close te lid then it all works fine again when I open, but lately it starts going haywire aain witin a few minutes. Sometimes it does seem to do thhis wen I touch the OUTER edge of the laptop (not the screen) to adjust the angle of the lid/cover. I am pretty sure the laptop is not more than a year old. But it may be I bought it a little over a year ago....Dont know if I still have the reciept but I might.....
    And my other HP laptop the G and H key work intermittently. In some apps tey work fine in and in oters they dont, like right now. Wats odd is if I type anoter letter, ten back space over it, then I can type a G or H fine no trouble. Very odd
    I used to love HP but I have A:LOT of trouble with thier laptops over the last few years. I wont buy another one.

    Hello @tiffcady,
    I understand that the TouchScreen feature of your notebook computer is not working as it should, and I would be happy to assist you in this matter!
    To correct the functions of the TouchScreen, I recommend following this document on Troubleshooting Touch Screen Issues in Windows 8. This should help to return your TouchScreen configuration back to default settings.
    Please re-post with the results of your troubleshooting, and I look forward to your reply!
    Regards   
    MechPilot
    I work on behalf of HP
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos, Thumbs Up" on the right to say “Thanks” for helping!

  • Im having trouble with my Messages. The keypad sensors are going haywire. The other apps like FbMessenger are ok. What should i do?

    The keypad sensors are going haywire. Only Messages has this problem. The other apps with messaging like FB messenger are functioning well.
    And its not just with typing; even with scrolling up or down, the sensors wont cooperate. Pfft.

    venicespent,
    Boot into your Mavericks Recovery partition by hold down the command and R keys whilst booting. You'll see a screen that looks like this:
    Click on the Disk Utility item to open Disk Utility. You should see your boot drive (usually named "Macintosh HD" unless you've changed it) in the column on the left of the screen. Select your boot partition and click on the "Verify" button. Let your Mac do it's thing - if you get green text telling you that everything seems to be OK, then your disk should not be damaged. If, however, you get red text telling you that the disk needs to be repaired, click on the "Repair" button. If the disk can be repaired, you should be good to go. If the disk cannot be repaired then the drive is damaged.
    But before you do anything, make certain that you have backups!!!
    Clinton
    MacBook Pro (15-inch Late 2011), OS Mavericks 10.9.4, 16GB RAM, 960GB SSD, 27” Apple Thunderbolt Display

  • HT1414 I just upgraded to an iPhone 5S and it is going haywire whenever I use it. Is there a way to resolve this without returning the phone?

    I just upgraded to an iPhone 5S and it is going haywire whenever I use it. It will randomly open applications, send emails suddenly before I am finished writing them, and much more. Is there a way to resolve this without returning the phone?

    Hi, jbgatch. 
    Thank you for visiting Apple Support Communities. 
    Our iOS devices use a capacitive touch screen and with it being winter in most places, a buildup of static electricity can cause the touch screen to act erratic.  Start with closing all applications open in multitasking and power cycling the device.  If using a screen protector, remove it and test without it installed.  Some cases that include a screen protector can cause this issue as well.  Try the remainder of the steps in the attached article below.  If the issue persists, a restore as new may been needed.  Make sure to backup your data prior to a restore. 
    iOS: Force an app to close
    http://support.apple.com/kb/ht5137
    iPhone, iPad, iPod touch: Troubleshooting touchscreen response
    http://support.apple.com/kb/ts1827
    Cheers,
    Jason H. 

  • IPhone 4s going Haywire while using Car Chargers..

    My iPhones 4s is going crazy while Charging in the car(via usb or AC). The touchscreen is unreponsive and it goes haywire when it responds.
    Apple Store replaced my phone but the new one is also doing the same. I had my wife try hers and it also gets wacked out..
    I have been a long time apple fan but i have been very dissapointed with all the problems my 1st iPhone has been giving us.
    Anyone else having this problem?

    Have you or anyone found a solution to the iphone 4S repeated burn out of car chargers?  I have Audi A6 2010, with three outlets.  Also have 3 different iphone approved chargers (Belkin, Griffin and Amazon) that all will not work (light doesn't go on to show there is a connection) and my iphones show no charge.  At the beginning iphone said it did not support this charger, but after adjusting the tightness of the connection, it started charging.  However, short term only, now doesn't work  All chargers have burned out.  Is there a specific brand for iPhone 4S that will not burnout and continue to work?

  • GT683DX - Touchpad going haywire

    The touchpad problem first started with the left touchpad button going completely dead sometime in Sept. or so. I contacted technical support to get the issue fixed but before I had the opportunity to send it back, it magically "fixed itself" for some reason. Now, over the past two weeks it will intermittently "go out" and another issue has popped up of the touchpad and/or button absolutely going haywire and clicking nonstop on everything the cursor is touching. Sometimes it will even happen if I am using an external mouse.
    Is anyone having a similar issue or could get me some guidance? It seems to be having the same issue in Windows and in Linux.

    As this happens in two OS it seems to be a hardware issue. RMA seems to be the only option (if still covered by warranty).

  • Hi, iPak II user.  Two keyboard keys won't work, and the picture goes haywire sometimes, flashing itself, bak to old stuff, typing in the safari line, all this going on vey fast.   Any fixes out there?

    Hi, iPak II user.  Two keyboard keys won't work, and the picture goes haywire sometimes, flashing itself, bak to old stuff, typing in the safari line, all this going on vey fast.   Any fixes out there?

    Sounds like it could be a hardware problem.
    Try a restart or reset to see if that helps. If not, contact Apple Support.
    Restart: Press On/Off button until the Slide to Power Off slider appears, select Slide to Power Off and, after It shuts down, press the On/Off button until the Apple logo appears.
    Reset: Press the Home and On/Off buttons at the same time and hold them until the Apple logo appears (about 10 seconds).
    No data will be lost.

  • Trackpad freezes and goes haywire

    My computer is 4 years old and in decent condition. For the past several months my trackpad has been freezing/going haywire every time I use the computer. This generally only happens while I am online. For example, I will be scrolling down, and it will freeze, the cursor won't go anywhere no matter how much I rub the trackpad. Or the cursor will start jumping around and the page will scroll up and down on its own. Usually I just run my fingers back and forth across the trackpad quickly for a few seconds and it will stop. But the problem will happen again a few minutes later. This happens on all sorts of websites, using Firefox.
    I can use an external mouse with no problem, but obviously that's not always possible.
    Thank you.

    HI and Welcome to Apple Discussions...
    Try resetting the PMU http://support.apple.com/kb/HT1431
    And try resetting the PRAM and NVRAM: http://support.apple.com/kb/HT1379
    And try cleaning the Trackpad. Take a clean lint free dampened cloth and wipe the Trackpad. Fingerprints, lotion.. takes a toll.
    Carolyn

  • I was using photoshop CC as normal, when suddenly it started going haywire. It has corrupted all the one PSD files by distorting the images and colour. Does anyone know how to recover the original images?

    I was using photoshop CC as normal, when suddenly it started going haywire. It has corrupted all the open PSD files by distorting the images and colour. They are now completely unrecognisable and unusable. Does anyone know how to recover the original images as I was saving them as I went along but the files are now corrupt?

    What version of Photoshop are you running?
    I've seen a couple of instances over the last week or two where Photoshop has added masks, strange colours and also merged content from two separate PSD files that were open at the same time.
    This has occurred on two different iMacs, (both 10.10.x) running Photoshop CC 2014.2.2 (20141204.r.310 x64).
    see image below for example:

  • 4th Gen iPod Touch music app is going haywire.

    Recently my 4th Gen iPod Touch (version 6.1.6 recently updated) refused to sync any music. I have had it synced to my computer for more than a year and have been adding new music with the 'Autofill' option. However, last night it refused to sync music. The songs are visible on my iPod but greyed out. This has happened before. Usually it will sync eventually but this time is different. Around the same time my iPod was claiming to be overcapacity. I looked up solutions but none seemed to be particularly helpful. I did delete some music and videos off my iPod to no avail.
    Eventually the problem seemed to fix itself with the overcapacity claim disappearing however the data then began to inflate and adjust itself out of nowhere. It would claim my music was taking up 30gig before saying 4gig. Everything seemed to be going haywire with the data reading. When I checked the music app the artists tab claimed I had no music. I selected a song and discovered that it wouldn't play but rather start shuffling in the playlist. I can't do anything to stop this. I have turned the iPod off and on and soft reset it (I think, I held the Power and Home button for several seconds) but the actions have done nothing. it is incredibly confusing as the iPod is only 2 years old and I would like to avoid buying a new one. I'm not sure how helpful a restore or reset would be but I will try it if there is no other option. I've searched the net for an hour trying to find out if anyone has encountered the same problem. Everything else works fine except for Notes which stopped opening months ago. Incredibly confused and would appreciate any help or advice.

    Try:
    - Reset the iOS device. Nothing will be lost      
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Unsync/delete all music and resync
    To delete all music go to Settings>General>Usage>Storage>Music>Tap edit in upper right and then tap the minus sign by All Music
    - Reset all settings                 
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup. See:                                               
    iOS: Back up and restore your iOS device with iCloud or iTunes
    - Restore to factory settings/new iOS device.                       

  • Clock goes haywire after resume

    After my PC wakes up from sleep, as soon as it connects to my network the time goes haywire. It goes several days in the future. NTPD is running and it is not fixing the time.

    I have the same issue here, like about 1 month or so. My laptop is ASUS N52DA - I think that posting some details can be useful.
    https://gist.github.com/1491574
    If someone needs any other info - please ask. Setting up NTPD doesn't help anything. On Windows it works fine.

  • My screen on my mac laptop just goes haywire lines scrolling

    My screen on my mac laptop just goes haywire. lines start scrolling from top to bottom for no reason.  any ideas

    Welcome to Apple Support Communities
    Hold the Shift key while your computer is starting to start in safe mode. Safe mode disables the advanced graphic drivers and third-party apps, so if it's a software problem, this will disappear.
    If your screen looks the same, your graphic card or display are damaged. Take your computer to an Apple Store or reseller to have the computer repaired. In both cases, this will be an expensive repair

  • MagSafe plugged in, orange charge led, time counter going down

    I've been plugged into 110v AC in my RV. MagSafe is plugged in, orange charge LED is "on" and the icon shows the lightning (charging symbol), BUT the time counter going down and down, and not in real time, more like football min's. We are running a bunch of other things like heater, another G4 and lights. Could this just be not enough coming through the single extension cord (NOT 30amp)?

    Yes Pink that is the case the LED lights stay yellow for charging and the white one for plugged in. When i turn it on now the screen doesn't show up and it turns off. And it does not turn on with the AC adapter only. I tried a new one at a local store but no luck with that either.
    I had the latest bios update before the most recent one:
    http://gulf.computers.toshiba-europe.com/innovation/download_bios.jsp?LNG=13&service=AE
    sadly i can't update it if it won't turn on :(
    I took it to the Toshiba Center today they said its a hardware issue. its only been a month and a few days /sigh im so bummed out atm i hope the motherboard won't have to be replaced.
    thanks

  • When emptying the trash, the counter goes up...

    What's going on when emptying the trash, the counter goes past zero on the way down and then proceeds into the tens of thousands of negative numbers? I am trying to get rid of back ups on my external disk.
    Thanks

    David Wilson24 wrote:
    But now, I just want to get the trash cleared so that further actions will work as far as future "emptyings".
    The count going negative is normal, in a way, when deleting TM backups.   Not a problem.
    If the trash won't empty, hold the Alt/Option key while selecting Finder > Empty Trash... from the menubar.
    You shouldn't ever need to delete backups, however. Let Time Machine delete old ones when it runs out of space.

  • I think my keyboard is going haywire

    since installing the last update, my keyboard is going haywire. certain letters stop working and a string of brackets appear in the text fields. sometimes it gets stuck on delete instead. (sent from my Android)

    The delete button doesn't work immediately, and then it just starts deleting everything and won't stop unless I click out of the text field.
    See if the Disk is issuing any S.M.A.R.T errors in Disk Utility...
    http://support.apple.com/kb/PH7029
    Open Activity Monitor in Applications>Utilities, select All Processes & sort on CPU%, any indications there?
    How much RAM & free space do you have also, click on the Memory & Disk Usage Tabs.
    Open Console in Utilities & see if there are any clues or repeating messages when this happens.
    In the Memory tab of Activity Monitor, are there a lot of Pageouts?

Maybe you are looking for