Solved

Compare variable's value in crystal......

Posted on 2000-04-21
14
162 Views
Last Modified: 2010-05-18
I tried to wrote same formula in 2 different ways but unfortunately it didn't run.
It gives me below mentioned error when i try to preview my report.

1)Error: Numeric Overflow.

StringVar X;
If {table_site.x_site_group} = "Bldg" then
    X := chr({table_site.objid})
Else If {table_site.x_site_group} = "Tenant" then
    If chr({table_site.child_site2site}) = X then
        {table_site.name}
    Else
        ""
Else
    ""

2)Error:The String is non-numeric.

StringVar X;
If {table_site.x_site_group} = "Bldg" then
    X := chr({table_site.objid})
Else If {table_site.x_site_group} = "Tenant" then
    If {table_site.child_site2site} = ToNumber(X) then
        {table_site.name}
    Else
        ""
Else
    ""

Let me know as soon as you can.


Thanks for your time in advance.

Thanks,
bhavesh55
0
Comment
Question by:bhavesh55
[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
14 Comments
 
LVL 44

Expert Comment

by:bruintje
ID: 2738033
is this C++?

could you see what's in X after the line

X := chr({table_site.objid})

maybe in a message or something?
0
 

Expert Comment

by:jfrankie
ID: 2738159
The `chr` function returns a string containing the character associated with the specified character code.

and you you have to pass a numerique value to that function.

If you want to convert to Character, you should use the str() function.

Hope that help.
0
 
LVL 3

Expert Comment

by:3rsrichard
ID: 2738288
behive keeps asking this same question over and over?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:y2kwacko
ID: 2739148
Looks like Pascal/Delphi to me based on the := portion
0
 

Author Comment

by:bhavesh55
ID: 2739165
All Experts
I am talking about "Crystal Report ver. 8.0".

Please let me know as soon as you can.

Thanks for your time in advance.

Thanks,
bhavesh55
0
 

Author Comment

by:bhavesh55
ID: 2739170
Fields in Sql-server Database:

x_site_group , name --> char
objid,child_site2site --> int

table_site --> table name

I put above mentioned formula in crystal report's formula editor and i unable to run it successfully.

Please try and let me know i can i fix that.

Thanks,
bhavesh55
0
 
LVL 15

Accepted Solution

by:
StingRaY earned 100 total points
ID: 2739590
Try this...
StringVar X;
If {table_site.x_site_group} = "Bldg" then
    X := ToText({table_site.objid},0)
Else If {table_site.x_site_group} = "Tenant" then
    If ToText({table_site.child_site2site},0) = X then
        {table_site.name}
    Else
        "" 
Else
    "" 
0
 

Author Comment

by:bhavesh55
ID: 2742434
StingRaY

I wrote below mention code:StringVar X;
If {table_site.x_site_group} = "Bldg" then    X := ToText({table_site.objid},0)
Else If {table_site.x_site_group} = "Tenant" then
    If ToText({table_site.child_site2site},0) = X then        {table_site.name}
    Else        ""Else    ""
It shows me value of "{table_site.objid}".Actually in "Else if" part i wrote
"{table_site.name}".Means if condition is satisfied than it should display
that value.Instead of that it displays me value of "objid".
Let me know how do i resolve this problem.Or whats wrong with it ?
Thanks for your time in advance.I am eagerly waiting for your reply.

Thanks,
bhavesh55
0
 

Author Comment

by:bhavesh55
ID: 2742435
StingRaY

I wrote below mention code:StringVar X;
If {table_site.x_site_group} = "Bldg" then    X := ToText({table_site.objid},0)
Else If {table_site.x_site_group} = "Tenant" then
    If ToText({table_site.child_site2site},0) = X then        {table_site.name}
    Else        ""Else    ""
It shows me value of "{table_site.objid}".Actually in "Else if" part i wrote
"{table_site.name}".Means if condition is satisfied than it should display
that value.Instead of that it displays most of the time value of "objid" and sometimes "name".
Let me know how do i resolve this problem.Or whats wrong with it ?
Thanks for your time in advance.I am eagerly waiting for your reply.

Thanks,
bhavesh55
0
 

Author Comment

by:bhavesh55
ID: 2742439
StingRaY
Above ones is not properly shown so i resubmit the same one.

I wrote below mention code:

StringVar X;
If {table_site.x_site_group} = "Bldg" then
    X := ToText({table_site.objid},0)
Else If {table_site.x_site_group} = "Tenant" then
    If ToText({table_site.child_site2site},0) = X then
       {table_site.name}
    Else    
         ""
Else    ""

It shows me value of "{table_site.objid}".Actually in "Else if" part i wrote
"{table_site.name}".Means if condition is satisfied than it should display
that value.Instead of that it displays most of the time value of "objid" and sometimes "name".

Let me know how do i resolve this problem.Or whats wrong with it ?
 
Thanks for your time in advance.I am eagerly waiting for your reply.

Thanks,
bhavesh55
0
 
LVL 15

Expert Comment

by:StingRaY
ID: 2744829
bhavesh55

StringVar X := ToText({table_site.objid},0);
If {table_site.x_site_group} = "Bldg" then
     X
Else If {table_site.x_site_group} = "Tenant" then
    If ToText({table_site.child_site2site},0) = X then
        {table_site.name}
    Else
        "" 
Else
    "";

At the first, I assign value of "objid" to X.
if x_site_group is "Bldg", yes it will return X.
if not...but is "Tenant", yes check if value is satisfied then return Site Name
unsatisfied the return "" (zero-length string)
other x_site_group will return "" (zero-length string)

Sorry, English language is not my native language, mine is Thai. I will apologise you if I mis-understand your question.

Happy with programming ^_^
0
 

Author Comment

by:bhavesh55
ID: 2745845
You didn't understand my question properly.

Anyway, i will give you points for your help.

Thanks,
bhavesh55
0
 

Author Comment

by:bhavesh55
ID: 2745846
StingRaY
You didn't understand my question properly.

Anyway, i will give you points for your help.

Thanks,
bhavesh55
0
 
LVL 15

Expert Comment

by:StingRaY
ID: 2746478
bhavesh55
Thank you for given score.
Email me with more information about your question.
This will not impact the score...
....
StingRaY
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

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