on 08-18-2015 3:45 PM
Hello All,
sample code:
value of ll_newrow = 0
Line 1 : dw_1.setitem(row, column name, dw_2.getitemstring(ll_newrow, column_name))
Line 2 : dw_1.setitem(row, column name, dw_2.GetNumber(ll_newrow, column_name))
In the line one i ma not getting the application termination error, but getting in the line 2.
can any one explain me.
note : all the columns name are valid.
Thanks& Regard
Rashmi Ranjan Giri
Why don't you just perform the GetItem<whatever> into their own local variables PRIOR to the setitem statements? That way you can actually see what is being returned?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry All,
It was wrongly typed.
Line 2 : dw_1.setitem(row, column name, dw_2.GetItemNumber(ll_newrow, column_name))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rashmi;
FWIW: To stop application crashes and handle the various error situations properly, I would recommend the following ...
1) You should be able to catch this and other errors if you code the following DC/DS events:
ItemError
Error
DBError
WSError
2) You also need to code the Application Error event as well.
3) Using a TRY..CATCH around your code would be even better.
As Neil points out ... GetNumber ( ) is not a standard DC/DS method. Sounds like something that your application developer has added.
HTH
Regards ... Chris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For columns with numeric data you should use GetItemNumber() or GetItemDecimal().
If your target column in dw_1 is of type string, you have to "cast" the value,
because dw.SetItem () expects the columns datatype.
So if the column's datatype in dw_1 and dw_2 do not match, use something like this.
dw_1.setitem(row, column_name, String (dw_2.GetItemNumber(ll_newrow, column_name)))
hth
Arnd
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
GetNumber is not a built-in datawindow method.
It could be that dw2 is inherited from a datawindow user object which has a GetNumber function that allows 0 row as parameter.
GetItemString is a built-in dw method and does not accept 0 row as parameter, so it throws runtime error.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Wrong. Datawindow objects have no inheritance but datawindow controls certainly do.
We do not understand what you are asking an explanation of.
The GetNumber() method is not a Powerbuilder function, so it must be custom code i.e. your custom code.
The GetItemString() method is a Powerbuilder function, and accepts an argument of a valid row number. Row 0 is never a valid row number. The expected result therefore is an error reporting the row number is invalid I would think.
You report when you run this you get an error (possibly invalid row number).
Only other thing i can think you are searching for is that the SetItem() method is overloaded. That is is SetItem( long, long ) is not the same as SetItem( long, string ) - hence - assuming your column is a numeric - you cannot update it with a string value ( the return type of GetItemString() )
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.