Solved

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

Posted on 2013-06-17
14
227 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
ID: 39253672
Can you have NULL values?

Can you show the 2 formulas?

mlmcc
0
 
LVL 1

Author Comment

by:susnewyork
ID: 39253701
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
ID: 39253721
You are missing a )

Try this one

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

mlmcc
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 35

Assisted Solution

by:James0628
James0628 earned 250 total points
ID: 39255689
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
ID: 39256241
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
ID: 39256249
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
 
LVL 1

Author Comment

by:susnewyork
ID: 39256258
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
ID: 39256261
And that was it! Thanks mlmcc.
0
 
LVL 1

Author Comment

by:susnewyork
ID: 39256267
Also, thanks for your help too James.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 39256284
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 35

Expert Comment

by:James0628
ID: 39256769
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
ID: 39256783
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
ID: 39256866
I could do it but since you requested their help I will let it happen that way.

mlmcc
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
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…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

749 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