Wepex
Wepex

Reputation: 163

PowerBuilder problems with long, longlong, integers, dec, and decimal datatypes

I am having problems with long, longlong, integers, dec, and decimal datatypes in PowerBuilder 12.5 Classic...
I did something like this and is giving me problems of datatypes;

// set variables for item price and the cash given by the customer

double price, cash

price=double(trim(sle_price.text))
cash=double(trim(sle_cash.text))



if cash="" then
    messagebox("","CASH")
    sle_cash.setfocus()
    return
end if

if  fare="" then
    messagebox("","SET FARE")
    sle_amount.setfocus()
    return
end if
double balance

balance=cash -price


 messagebox("",balance)

INSERT INTO cash_table  
         ( items.price   

  VALUES ( :price );

Upvotes: 0

Views: 4380

Answers (2)

Maximus
Maximus

Reputation: 10845

From my comment

Why you try to compare double with string?

Comparing different types are illegal. Correct example

if trim(sle_cash.text) = "" then

Upvotes: 3

Snow Blind
Snow Blind

Reputation: 1164

I think you are comparing double cash and double fare variables with "" (empty string) to find out if input fields are empty or not. Instead of that way, you can do something like this:

if trim(sle_cash.text)="" then
    messagebox("","CASH")
    sle_cash.setfocus()
    return
end if

if  trim(sle_fare.text)="" then
    messagebox("","SET FARE")
    sle_amount.setfocus()
    return
end if

Upvotes: 0

Related Questions