Solved

Formula doesn't run and comes up as a blank error... simple formula

Posted on 2013-06-17
14
220 Views
Last Modified: 2013-06-19
Hi,

I have a formula that converts a datetime to a time with the format of HH:mm:ss. That formula by itself works fine. The value is converted from time to string. It's names Time.

I then add that formula to another formula (named Concat) that concatenates multiple string values together. This formula will stop the report from running if I add the Time formula to it. There is no error produced; the Time formula within the Concat formula is highlighted and the report will not continue.

The formula will pop up and highligh Time and not mention any real issue. When I check the code, there are no errors....
0
Comment
Question by:susnewyork
  • 6
  • 5
  • 2
14 Comments
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
Can you have NULL values?

Can you show the 2 formulas?

mlmcc
0
 
LVL 1

Author Comment

by:susnewyork
Comment Utility
I forgot to mention the third formula. To be clear:

TimeString: Takes the dateTime field and changes it to a text time format.

Time: Takes TimeString and adds spaces to the end of the string as needed by my company.

Concat: Takes all needed fields and adds them to a text string.

------------------------------------------------------------

TimeString:
totext(time({TAData.DateTime}), "HH:mm:ss")

Open in new window


Time formula:
if length({@timeString}) < 11 then {@timeString} + space(length({@timeString}) - 10) else {@timeString}

Open in new window


Concat formula:
totext({@ClockID}+{@date}+left(totext({@ScanID}),1))+{@time}

Open in new window



--------------------------------------------
I just noticed that when I change the concat formula to exclude the Time formula, the following error appears for the Time formula:

"The number of copies of the string is too large or not an integer"
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
You are missing a )

Try this one

totext({@ClockID}) + {@date} + left(totext({@ScanID}),1)) + {@time}

mlmcc
0
 
LVL 34

Assisted Solution

by:James0628
James0628 earned 250 total points
Comment Utility
Your @Time, or possibly @TimeString, formula is wrong.

 @Time checks for length < 11, but the "HH:mm:ss" format is only 8 characters.  In fact, it will always be exactly 8, because "HH", "mm" and "ss" include leading zeroes.  So the length will always be < 11.

 The problem is that you then use Space (Length ({@timeString}) - 10), which gives you Space (8 - 10), or Space (-2), and that's invalid (you can't have a negative number of spaces).

 So, the question is, what are you trying to do with that < 11 check?

 James
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 250 total points
Comment Utility
You probably really want to reverse the subtraction.  I suspect you are trying to add spaces to make sure there are 11 characters being added.

 Space (11 - Length ({@timeString}) )

mlmcc
0
 
LVL 1

Author Comment

by:susnewyork
Comment Utility
Hi James,

I have a similar formula that does the same thing with date. The date doesn't produce an error. The formulas for the date set:

DateString:
totext(date({TAData.DateTime}), "MM/dd/yyyy")

Open in new window


Date:
if length({@dateString}) < 11 then {@dateString} + space(10 - length({@dateString})) else {@dateString}

Open in new window


Concat:
totext({@ClockID}) + {@date} + left(totext({@ScanID}),1) + {@time} 

Open in new window


The formula runs without a problem. Thoughts?
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 1

Author Comment

by:susnewyork
Comment Utility
Ah. Let me try that. The date formula has the order as you said it might have to be.
0
 
LVL 1

Author Comment

by:susnewyork
Comment Utility
And that was it! Thanks mlmcc.
0
 
LVL 1

Author Comment

by:susnewyork
Comment Utility
Also, thanks for your help too James.
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
You could have split the points with James.  His comment really pointed out the error or problem.

The question can be reopened to allow you to split.

mlmcc
0
 
LVL 34

Expert Comment

by:James0628
Comment Utility
Good catch on the solution mlmcc.  It seems obvious now that you've pointed it out, but for some reason it just didn't click here.

 James
0
 
LVL 1

Author Comment

by:susnewyork
Comment Utility
I'm trying to reopen the question to reassign points. Mlmcc is right.

Is there an easy way to do that? I currently have the question marked for a moderators attention.
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
I could do it but since you requested their help I will let it happen that way.

mlmcc
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now