Code to run for Last full month, not current month in Crystal and also what would be code for Teradata.

Want to schedule a report in crystal and would like to run for previous full month. How do you modify this line so that it always runs for previous full month. Report will be ran on 8th day of each month for the previous Full month.

 CAST (pat_enc.contact_date AS DATE) BETWEEN '2017-08-01' AND '2017-08-31'
Culwatrnca11Data AnalystAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Darrell PorterEnterprise Business Process ArchitectCommented:
Try the following:

CAST (pat_enc.contact_date AS DATE) IN LASTFULLMONTH

Open in new window

0
mlmccCommented:
I assume that is part of a Crystal Command

That shoud work

You can also do it in the Selection Formula

Date({pat_enc.contact_date}) in LastFullMonth

mlmcc
0
Culwatrnca11Data AnalystAuthor Commented:
not sure how to add either of these suggestions to my crystal.    Here is what my selection formula looks like. How would i encorporate the Cast or Date suggestions?

{Command.APPT_STATUS_C} = 2 and
{Command.BENEFIT_GROUP} startswith ["PROVPREV", "SURGCOLO"] and
{Command.CPT_CODE} startswith ["44388", "44389", "44392", "44393", "44394", "44401", "45300", "45305", "45308", "45309", "45315", "45320", "45330", "45331", "45333", "45338", "45346", "45378", "45380", "45383", "45384", "45385", "45388", "74261", "74262", "74263", "G0104", "G0105", "G0106", "G0120", "G0121", "G6019", "G6024"]
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

mlmccCommented:
Try it this way

{Command.APPT_STATUS_C} = 2 and
{Command.BENEFIT_GROUP} startswith ["PROVPREV", "SURGCOLO"] and
 {Command.CPT_CODE} startswith ["44388", "44389", "44392", "44393", "44394", "44401", "45300", "45305", "45308", "45309", "45315", "45320", "45330", "45331", "45333", "45338", "45346", "45378", "45380", "45383", "45384", "45385", "45388", "74261", "74262", "74263", "G0104", "G0105", "G0106", "G0120", "G0121", "G6019", "G6024"]
AND  Date({pat_enc.contact_date}) in LastFullMonth

mlmcc
0
Culwatrnca11Data AnalystAuthor Commented:
Neither suggested solution worked for my issue.  I ended up using this to resolve my issue. If it helps anyone else trying to pull for lastfullmonth

my solution:
PAT_ENC.CONTACT_DATE BETWEEN (ADD_MONTHS(CURRENT_DATE,-1) -  DAYOFMONTH(ADD_MONTHS(CURRENT_DATE,-1)) +1)  AND CURRENT_DATE -  DAYOFMONTH(CURRENT_DATE)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Culwatrnca11Data AnalystAuthor Commented:
Came up with my own solution but I am still awarding points based on both experts assisting in trying to solve my issue because I really appreciate the effort.    Thank you for your time..
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Teradata

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.