Date function problems with dates from core not recognized as dates

Our core provides dates in two formats: YYYYDDD and MMDDYY (YYYYDDD for today [2/21/12] would be 2012052).  We have determined that Crystal Reports is not viewing them as dates, but rather numbers. If querying on just a specific date, no problem. But if I want to use a date function like DayOfWeek, then things don't work.
I need a report to always provide yesterday's data - except on Monday, where it needs to look back at Friday.
I tried a criteria of:
if DayOfWeek(CurrentDate) = 1 then {DDMAST.DATOP7} = CurrentDate - 2 else
if DayOfWeek(CurrentDate) = 2 then {DDMAST.DATOP7} = CurrentDate - 3 else
{DDMAST.DATOP7} = CurrentDate -1
{DDMAST.DATOP7} is the date field from our core.
I tried this but got an error message of "A Number is Required Here" and it highlights the CurrentDate - 2.
Since we believe that Crystal Report is not viewing our dates as dates - but viewing them as numbers, what do I need to do to correct this?  Someone suggested I'd need to extract each date portion (month, date, and year) and create variables to "build" a date that Crystal Reports would understand.  Any suggestions?

Hi, 
You're correct.  There appears to be two branches in this thread. 
To address your issue, Crystal only recognizes actual date types, ie. Months, Days and Years.  Your serial date isn't a recognized date type so we have to: 
1)  Determine which format your date field is
2)  Convert your number to a date using the appropriate formatting. 
I am assuming your dates will either be 6 (MMddyy) or 7 (yyyyddd) characters long.  If there are other patterns you'll need to determine that. 
The problem I found is what does your date for today (March 6, 2012) look like in MMddyy format? 
Any month before October would never have a leading 0 if your date is stored as a number.  So you should take that into account as well using my logic. 
I added that into the logic by checking for a length of 5. 
NumberVar Full := 030612;
StringVar myDate;
myDate := ToText (Full, 0, "", "");
Select Length (myDate)
    Case 5: Date (2000 + ToNumber (myDate [4 to 5]), ToNumber (myDate [1]), ToNumber (myDate [2 to 3]))
    Case 6: Date (2000 + ToNumber (myDate [5 to 6]), ToNumber (myDate [1 to 2]), ToNumber (myDate [3 to 4]))
    Case 7: Date (ToNumber (myDate[1 to 4]), 1, 1) + (ToNumber (myDate [5 to 7]) - 1)
    Default: Date (0, 0, 0);
If you edit the first line and change it to: 
NumberVar Full := 2012066;
You will also get today's date.

Similar Messages

  • For Those Having Problems with iTunes 7.0 Not Recognizing Your iPod

    Hello all:
    So I was having the same issues that I have seen many others have. I install iTunes 7.0 and can no longer get my iPod to connect. I was about ready to uninstall and revert back to 6.0.5. However, I tried this instead:
    1. Close iTunes.
    2. Connect iPod.
    3. Go to Control Panel.
    4. Add/Remove Programs
    5. Find iTunes and highlight it but do not select Remove.
    6. Select Change.
    7. Select the option to Repair.
    8. Let the repair finish and select Finish when done.
    9. Open iTunes and your iPod will hopefully show up.
    Confirmed to work with 1st Gen 4GB nano on Windows XP Pro SP2. YMMV.
    Best of luck,
    John

    BTW, this is only a temporary fix as you will have to do this each time you reconnect to your computer. I know it is a hack but something is better than nothing until Apple releases a fix.

  • I have a problem with itunes account did not find a solution.

    Good morning
    I have a problem with itunes account did not find a solution.
    The problem: your apple id has been Dasabld
    I can not if download applications from the iTunes store
    Hoping to help me solve the problem
    Note my English is very weak
    I want to re-activate the iTunes account
    Thank you

    To Contact iTunes Customer Service Use this Link...
    Apple  Support  iTunes Store  Contact

  • Problems with OPMN from Companion CD (Oracle 10g R2 x86_64 RHEL4)

    I have installed Oracle 10g DB R2 64bit on RHEL4 x86_64 (AMD64) and HTTP-Server from Companion CD
    All works.
    But after running opmn appears problems:
    1. The system message to syslog: "ip_conntrack: table full, dropping packet"
    2. 'netstat -a' displays me thousands TCP-session on localhost to port 6100 in TIME_WAIT state
    And network services on my host more died than alive...
    If I increase ip_conntrack kernel parameter, then network state alive. But the problem with TCP-sessions is not resolved.
    Any ideas?
    Thanks, and sory for my english :-)
    P.S. I have RHEL4 without update 1, but with new kernel and patched binutils. Update of RHEL can resolve this problem?

    Thank you!
    The problem described in Metalink Doc-ID Note : 284602.1 is my case!
    But this document applies to Oracle Net Services - Version: 10.1.0.2 to 10.1.0.3.
    I have Version 10.2.0.1.0 and the problem apears again (with some symptoms are differ).

  • Hi. I have a problem with downloading from app store while last three days. An error did mot allow me to that. It's number is 1009.

    I have a problem with downloading from app store while last three days. An error does not allow me to take any app. The error number is 1009.

    Thats the ugliest code I've seen in a while and may be hampering your abilities to debug it. No offense - you have to start somewhere - think of it as somewhat constructive criticism.
    However, I cannot find any place where this is happening. Its happening on line 193.
    Also, this only happens when you try to move certain pieces to certain squaresThat might be a clue. Try printing out the indexes before line 193 and see what happens. Maybe use a debugger to step through your code.

  • Who else has a problem with parental controls enabled not being able to run Firefox on the Mac?

    Who else has a problem with parental controls enabled not being able to run Firefox on the Mac? (Any solutions?) (BTW. Chrome doesn't work either)

    Although FF4 is so nice I'm almost ready to ditch iGoogle!
    Please fix what appears to be an RSS/iGoogle issue with FF4...
    Gmail is fine, but titles dont show in most RSS feed gadgets and no stories, strangely, apart from this one:
    http://www.google.com.au/ig/directory?hl=en&url=www.google.com/ig/modules/builtin_news_technology.xml
    Which if you enter the last part of the url reports that
    "<Content type="html">
    This is a builtin module, so the UserPrefs and Content are ignored."
    Any ideas?

  • Having problem with primary sever will not connect, my internet connection is working

    Having problem with primary sever will not connect, my internet connection is working

    Hello pp585,
    Thank you for using Apple Support Communities.
    For more information, take a look at:
    Can't connect to the iTunes Store
    http://support.apple.com/kb/ts1368
    Troubleshoot issues on a Mac
    If you haven't been able to connect to the iTunes Store, a software conflict or your Internet service provider (ISP) may be blocking your access.
    Update iTunes and Safari to the latest version.
    If you have a firewall, your settings may be preventing you from connecting to the iTunes Store. Follow these steps to configure your firewall.
    You may need to reset your keychain. Connection issues are occasionally caused by keychain issues. Learn how to use Keychain First Aid to resolve any issues with your keychain.
    If you're receiving a specific error message, follow these steps.
    If the issue still persists, contact your Internet service provider and confirm that these ports and servers are enabled over your network.
    Have a nice day,
    Mario

  • Is anyone having problems with the program MacKeeper not runing a full scan in Mavericks?

    Is anyone having problems with the program MacKeeper not runing a full scan in Mavericks?

    Do not install MacKeeper (and how to uninstall it if you have):
    https://discussions.apple.com/docs/DOC-6221
    by Klaus1
    (Please note that references to the original developers, Zeobit, also now refer to Kromtech Alliance Corp, who acquired MacKeeper and PCKeeper from ZeoBit LLC in early 2013.
    And Here  >  Beware MacKeeper
    In General 3rd Party AV Software is Not Required as Mac OS X tends to look after itself.
    Read Here  > https://discussions.apple.com/thread/4545776?tstart=0
    See Here  >  Antivirus Discussion

  • K8t Neo2 problem with resume from standby after BIOS flash

    Previously while using the 3.2 BIOS and a Winchester 3200+, Both Standby and hibernation worked perfectly almost without fail.  Since I flashed the BIOS to 9.3 and installed an X2 4200+ I have had a problem with resume from standby.  The machine starts up OK but the 2nd processor core (cpu1) is almost maxed out and stays that way.  Task manager shows total cpu load as about 45-50% (all on cpu1) but shows no running process using any cpu load, just the usual System Idle process at about 99%.  The only way to get it back down to normal again seems to be to reboot.  By Contrast Hibernation works fine, with no increase in cpu load after resume.  I have all the latest MS patch's installed (I think!) the AMD dual core driver and the MS and AMD dual core optimizers.  Any ideas what is going on?

    Noticed last night that S! standby seems to work OK.  Also was experimenting with a fresh windows install on a spare hard drive (checking on another problem).  The fresh windows install appeared to work with S4 hibernation, so it looks like that is the answer to that problem.  However the problem with high cpu load on the second core after resume from S3 suspend to RAM standby was still present.  This problem is so specific and so repeatable (it does it every time without fail), that I feel there must be some very well defined reason for it.  Unfortunately I have no ideas what could be wrong. Have now tried Windows re-install, latest cpu drivers, AMD dual core optimizer, MS dual core optimizer, Cool'n'quite disabled/enabled, and various others and suspend to RAM still gives the same behaviour

  • Has anyone ever had a problem with their iphone 4 not syncing and/or writing a backup file?

    Has anyone ever had a problem with their iphone 4 not syncing and/or writing a backup file?  Itunes locks up when i attempt a sync as well as when I transfer my purchases from my phone to Itunes. I'm running Itunes 10.4.1 on iOS 4.3.5.  All of this is running on an 8 year old hp pavillian laptop running XP Pro that is fully updated. Could my phone have a bug or a hardware problem. Are there any known problems with  iOS 4.3.5?  Pretty frustrating problem so I'm hoping that someone has heard of this and can offer some suggestions on a solution.  Thanks a bunch.

    Did you used to have service and now suddenly you don't?
    This happened to me a few years back, and several other iPhone users in my neighborhood, and after a while on the phone with AT&T they figured out that a technician had recently adjusted the receiver/sender on the tower and it was slightly off. They sent them back up and I actually had a better signal after than I did before it went out.
    I would call AT&T and explain the issue you are having and see if they can fix it.
    If you never had service there then like wjosten said it's probably just a bad zone.
    Hope you get it sussed out.
    -PM

  • I recently upgraded to iTunes 11.1.5 and now my iPod Nano is not recognized in iTunes. I also upgraded my iPhone 5s to iOS 7.1. i Tunes on my computer does recognize my iPhone. What is the problem with my iPod Nano not being recognized?

    I recently upgraded to iTunes 11.1.5 and now my iPod Nano is not recognized in iTunes. I also upgraded my iPhone 5s to iOS 7.1. i Tunes on my computer does recognize my iPhone. What is the problem with my iPod Nano not being recognized?

    I would think, Twins1995, that if we are having the problem, others are as well. Hopefully, Apple will shortly issue a follow-up software release to fix the problem. Or is that just wishful thinking on my part.
    It would be helpful, if there were some kind of work-around in the interim, so we can use our devices. Pretty frustrating when you consider that all of the hardware and software is produced by Apple.

  • Windows 8.1 Problem with games from windows store.

    I've got a problem with games from windows store. The installation is going well without any problems, however when I try to open it it's loading and then it turns off. The same problem happens when I try to use Games for Windows. I've use a sfc scan and
    it shows some errors but unfortunately it cannot fix them. Should I share the CBS log or find the solution somewhere else? I hope you help, best regards.

    Hi,
    According to my experience, the problem like store game app open failed probably caused by hardware driver. such as Audio and Graphic driver. So, first of all, please try to reinstall these two driver to fix this problem for test.
    In addition, for SFC scan failed problem, it can be caused by many reasons, I would suggest you use another command to fix your system for test.
    Dism /Online /Cleanup-Image /ScanHealth
    Also you can test SFC command in Windows 8.1 safe mode.
    Thirdly, if problem persists, please check Event Viewer, generally speaking, it would record the app open failed events.
    Roger Lu
    TechNet Community Support

  • I have problem with buying from iTunes Store

    I have problem with buying from iTunes ??!!
    I've put all of my info cards
    What can i do ?!

    Are you trying to spam the forum with 6 the same posts?
    Please give more details of your problem and answer the question below:
    Is the app available in your country?
    Are you using the App Store for your country?

  • I have a problem with the mac can not read video files with the extension IMOD. How can I solve this problem?

    I have a problem with the mac can not read video files with the extension IMOD. How can I solve this problem?

    By doing a Google search. 

  • ITunes needs to fix the problem with there gift cards not being activated this is not up to the retailer and they will not return scratched coded cards! There is thousands of people having this problem please fix it

    iTunes needs to fix the problem with there iTunes cards not activating properly! This is not the retailers fault and they will not return iTunes cards that have had the code area scratched there for apple needs to credit and or activated the cards there is thousands of people having this problem please bite the bullet and fix it already I will not be using iTunes until this is corrected...

    If you haven't received the item then try the 'report a problem' page to contact iTunes Support : http://reportaproblem.apple.com
    If the 'report a problem' link doesn't work then you can try contacting iTunes support via this page : http://www.apple.com/support/itunes/contact/- click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption

Maybe you are looking for

  • Help required  when using Function module F4_INT_TABLE_VALUE_REQUEST

    Hi, I wrote the logic as follows. Select-options: s_lgart FOR pa0015-lgart.   SELECT lgart FROM t512z INTO TABLE it_temp WHERE infty = '0015' AND lgart IN rlgart.   IF NOT it_temp[] IS INITIAL.     SORT it_temp BY lgart.     DELETE ADJACENT DUPLICATE

  • 2 different ipods in itunes?

    this might be a stupid question but can you have 2 different ipods (touch 2nd gen) & (5TH gen) hooked up? I don't mean at the same time (or can you) BUT when the other one is done, hook the other one up. Will it conflict with the other ones softwere

  • Jumping to a scene in an external swf

    hi i have two fla files that i want to link together. say part_1.swf and part_ 2.swf from part_2.swf i want to have a button that take me to a particular scene of part_1.swf i use loadmovie on level 0 so that when it jumps to part 1 it completely rep

  • DiVi CAM 316 with 1GB SD?

    I just bought a DiVi CAM 316 and need to purchase SD card. Can the DiVi CAM 316 support 1 GB SD? Hope someone is able to help. Thanks in advance.

  • Durations in Slide Shows

    I cannot see how you adjust the duration of each slide in a slide show. The up and down arrows don't seem to work. Is it dependant on the number of slides and the total length of soundtrack? It's stuck on 4 secs all the time. Also the speed on the de