?
Solved

Number required here

Posted on 2011-10-02
9
Medium Priority
?
223 Views
Last Modified: 2012-05-12
I have no idea why this wont save. It thinks LINE NUMBER 18 Local StringVar strDesc should be a number.


Local StringVar strDesc := "";
shared numbervar strDescl := 0;
Local NumberVar intDescLen := 0;
Local NumberVar intDescLenMax := 75;
Local NumberVar i :=0;
Local NumberVar j :=0;
Local NumberVar intArrayCountIncrease := 0;

If Not(IsNull({ListOfProfDetailCost.PresCostType1__SummarizeToRel__Description})) and  {ListOfProfDetailCost.PresCostType1__IsHardCost} = False  Then
    (
       if shared stringvar to_inv = '01' then
        (
        strDesc := {ListOfProfDetailCost.PresNarrative};
        intDescLen := Length(strDesc);
        strDescl := Length(strDesc);
        )
       Else
        strDesc := {ListOfProfDetailCost.PresCostType1__SummarizeToRel__Description};
        intDescLen := Length(strDesc);
        strDescl := Length(strDesc);
    )
Else
    intDescLen := 0;
    strDesc := "";

Open in new window

0
Comment
Question by:mowit
  • 5
  • 3
9 Comments
 
LVL 60

Expert Comment

by:Kevin Cross
ID: 36900286
Is {ListOfProfDetailCost.PresCostType1__SummarizeToRel__Description} coming back as a number? You may need to convert it to string.
0
 
LVL 60

Expert Comment

by:Kevin Cross
ID: 36900299
Please try replacing:
strDesc := {ListOfProfDetailCost.PresCostType1__SummarizeToRel__Description};

Open in new window


With:
strDesc := CStr( {ListOfProfDetailCost.PresCostType1__SummarizeToRel__Description} );

Open in new window

0
 

Author Comment

by:mowit
ID: 36900372
@mwvisa1 i tried that and it didn't work.

On line 1 I declared Local StringVar strDesc as a string. Only with in the second if /else block it thinks a number should be there not string. Something is out of scope. I think the issue is my nested if / else block but I been stuck trying to fix it.
0
New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

 

Author Comment

by:mowit
ID: 36900393
I got it working. thanks
0
 

Accepted Solution

by:
mowit earned 0 total points
ID: 36900396
Local StringVar strDesc := "";
shared numbervar strDescl := 0;
Local NumberVar intDescLen := 0;
Local NumberVar intDescLenMax := 75;
Local NumberVar i :=0;
Local NumberVar j :=0;
Local NumberVar intArrayCountIncrease := 0;


If Not(IsNull({ListOfProfDetailCost.PresCostType1__SummarizeToRel__Description})) and  {ListOfProfDetailCost.PresCostType1__IsHardCost} = False  Then
    (
       if shared stringvar to_inv = '01' then
        (
        strDesc := {ListOfProfDetailCost.PresNarrative};
        intDescLen := Length(strDesc);
        strDescl := Length(strDesc);
        )
       Else
        (
        strDesc := {ListOfProfDetailCost.PresCostType1__SummarizeToRel__Description};
        intDescLen := Length(strDesc);
        strDescl := Length(strDesc);
        )
   )
Else
    intDescLen := 0;
    strDesc := "";
0
 

Author Closing Comment

by:mowit
ID: 36929438
Solved
0
 

Author Comment

by:mowit
ID: 36900420
Well, it saved but its not working as expected. Its evaluating the last else and setting the values to " '.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 36900443
You need to have ( ) after the last Else

Else
(
    intDescLen := 0;
    strDesc := "";
    strDecsl := 0;
)

For some reason the THEN and ELSE parts of an IF have to return the same type of value.

The way you had it the THEN returned a number and the else was returnung a string.


mlmcc
0
 
LVL 60

Expert Comment

by:Kevin Cross
ID: 36900482
I am sorry. You pointed to line 18 as the error. I did not even catch the Else since I was looking at the LINE NUMBER you pointed to. I agree with mlmcc. Note you have () missing from the outer Else also.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

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…
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…
Integration Management Part 2
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

840 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