The result of selection formula must be a boolean in Crystal Report
I want to convert string to datetime in crystal report, I used Date(YYYY,MM,DD) and CDate(YYYY,MM,DD) like a tip but have error: The result of selection formula must be a boolean.
stringVar dt := {Control_pmt_tlmytvResu开发者_StackOverflow社区lt.ngaydk};
Date (Val (dt[1 to 4]),Val(dt[5 to 6]) ,Val(dt[7 to 8]))
Control_pmt_tlmytvResult is formatted string: YYYY-MM-DD HH:mm:ss
You're attempting to return a date in a selection formula (Whether it is a Record, Group, or Saved Data selection formula) and CR doesn't know how to handle that situation. It must be a boolean because selection formulas essentially tell the report to only include data where the formula evaluates to TRUE.
This is like asking, "What do you want on your pizza?" and getting the response "December 7th!" Crystal Reports is asking what data you want to include in the report (via selection formula) and you're responding "December 7th". If you want that date to be useful as selection criteria, you have to use it via a boolean statement like {transactions.date} < dt
. Now the report would include all transactions prior to the date you have just computed.
精彩评论