Number required here

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

mowitAsked:
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.

Kevin CrossChief Technology OfficerCommented:
Is {ListOfProfDetailCost.PresCostType1__SummarizeToRel__Description} coming back as a number? You may need to convert it to string.
0
Kevin CrossChief Technology OfficerCommented:
Please try replacing:
strDesc := {ListOfProfDetailCost.PresCostType1__SummarizeToRel__Description};

Open in new window


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

Open in new window

0
mowitAuthor Commented:
@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
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

mowitAuthor Commented:
I got it working. thanks
0
mowitAuthor Commented:
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

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
mowitAuthor Commented:
Solved
0
mowitAuthor Commented:
Well, it saved but its not working as expected. Its evaluating the last else and setting the values to " '.
0
mlmccCommented:
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
Kevin CrossChief Technology OfficerCommented:
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
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
Crystal Reports

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.