Click here to Skip to main content
13,590,519 members
Rate this:
Please Sign up or sign in to vote.
Hi all,
I need to convert the power builder code in
this is the power builder code
receiptdate +" ("+Mid(Upper(dayname( receiptdate )) ,1,3)+")"

I tried to convert it like this
stringvar ReceiptDate = {DataTable1.ReceiptDate};
numbervar dayname = Mid(UpperCase(Day( {DataTable1.ReceiptDate})) ,1,3);
cstr(ReceiptDate) & cstr(dayname);

but when i want to save it in crystal report,it come out an error state that "A date is required."
Can anyone guide me how to solve it? Or is there any website that have tutorial about declaring variable in crystal report
Posted 27-Dec-12 20:40pm
Updated 28-Dec-12 15:07pm
Please stop posting non-answers as "solution". It can give you abuse reports which eventually may lead to cancellation of your CodeProject membership. And the fact you even self-accepted on formally is just outrageous, a sure way for a ban. I hope you won't do it after this warning.

Comment on any posts, reply to available comments, or use "Improve question" (above).
Also, keep in mind that members only get notifications on the post sent in reply to there posts.

Des DC 5-Apr-13 20:42pm
this is my first post. The time I still don't know it got comment and question button to let other know the notification. After this post only I know there can use comment and question to get notification. I will take notice afterward. Thanks for the remind.
No problem at all.
Thank you for understanding.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

check datatype of field {DataTable1.ReceiptDate} it should be datetime

Happy Coding!
Aarti Meswania 29-Dec-12 1:33am
if your field's datatype is not datetime then
in sql query you should convert field in datetime


give me an example in how your date come in report
it's format is
DD-MM-yyyy or yyyy-MM-dd or something else...
Des DC 30-Dec-12 1:57am
the format is in dd-mm-yyyy.
Aarti Meswania 30-Dec-12 7:33am
do like this...

stringvar yyear;
stringvar mmonth;
stringvar dday;

dday := Mid({DataTable1.ReceiptDate},1,2);
mmonth := mid({DataTable1.ReceiptDate},4,2);
yyear := right({DataTable1.ReceiptDate},4);

{DataTable1.ReceiptDate} + WeekdayName(DayOfWeek(Date(yyear ,mmonth, dday)))
Des DC 30-Dec-12 23:57pm
sorry for late reply.
I solved the problem by editing the format of the data.
anyway thanks for your help. :)
Aarti Meswania 31-Dec-12 0:21am
welcome! :)
Glad to help you! :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web03-2016 | 2.8.180618.1 | Last Updated 28 Dec 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100