Click here to Skip to main content
Rate this: bad
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 21:40pm
Des DC533
Edited 28-Dec-12 16:07pm
Sergey Alexandrovich Kryukov at 5-Apr-13 14:50pm
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 at 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.
Sergey Alexandrovich Kryukov at 5-Apr-13 20:58pm
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!
Smile | :)
Aarti Meswania at 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 at 30-Dec-12 1:57am
the format is in dd-mm-yyyy.
Aarti Meswania at 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 at 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 at 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
0 OriginalGriff 410
1 Jochen Arndt 200
2 Richard MacCutchan 135
3 DamithSL 105
4 PIEBALDconsult 90
0 OriginalGriff 6,045
1 DamithSL 4,601
2 Maciej Los 4,032
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,220

Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 28 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

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