Solved

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

Posted on 2013-06-17
14
228 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

 
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Crystal Report GH Suppress Formula not acting as expected 10 49
Count If in Crystal Reports 2 33
Crystal Reports - help with converting time in a formula 4 24
Timezone help 5 45
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Suggested Courses

751 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