Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Content Management (Extended ECM)
API, SDK, REST and Web Services
Incorrect values returned by CAPI.Exec
Vikrama_Billava
We are facing a strange problem with CAPI.Exec. We are trying to retrieve records using a simple SQL query. The value for the primary key (AMENDMENTID) is always returned with 'g' as a prefix. The same query in oracle behaves properly and does not prefix anything to the value. Please advise.Details ? Livelink version 9.2Oracle Version ? 9iPlease see attached the table structure
Find more posts tagged with
Comments
Carsten_Kulms
Message from Carsten Kulms via eLinkI think the prefix appears only when the value is converted to a Stringby means of Str.StringToValue.Actually the value is a Real since the column type does not fit in anInteger.
Pravs4
Hello Dave,Its not incorrect but expected behaviour of the function...I have experienced, when the DataType of Oracle Table column has more than 10 digits i.e. more than NUMBER(10, 0) in your case its NUMBER (15, 0), 'G' is prefixed before the values in Oscript indicating Oscript DataType as Real as Integer cannot hold such large values...You could just use Type Casting if you want to remove the 'G'.e.g. if you have rec array returned, you can just loop through it and assign ammendmentid value to an temp integer variable like - Record recInteger tempIntAmmendmentIdfor rec in resultRecArray tempIntAmmendmentId = rec.AmmendmentId; // Process the current tempIntAmmendmentId, do whatever you wanna do...endHope this helps...Pravin.
Pravs4
Other workaround is -NUMBER (15, 0) indicates that its a Decimal Number which in Oscript will be Real and hence prefiexed with 'G' (Any Real variable value will be prefixed with G in oscript - Verify in Debug mode)If you simply declare AMENDMENTID as NUMBER(15), I believe the 'G' wont be prefiexed before the values...
sıɹɥɔ
Message from Chris Webster <
cwebster@opentext.com
> via eLink
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">eLink
Hi David,
This is a common issue so I'd like to reiterate what the other posters have said.
CAPI.Exec needs to map the types in the query results to OScript data types. For database numeric values that exceed the 32 bits range of an OScript Integer type it assigns to a Real.type. In your situation you have a Real value being returned from CAPI.Exec and it can be used as-is.
The "g" appears when a particular representation of a Real is produced by the use of Str.ValueToString(), either directly or indirectly. There is no "g" in the value.
In case this isn't clear it can be helpful to recognize this situation is analagous to the Date type. If a Date is shown with OScript it might produce output of
Thu Feb 05 07:17:39 2009,
or
D/2009/2/5:7:17:39
, or some other representation. Of course the database does not contain the letters "T", "h", "u", or "D", etc., and CAPI.Exec did not generate them. As the documentation says "
Dates are stored in an internal, platform-independent format and should not be confused with String representations of dates.
". The particular representation seen is dependent on the method to generate it. This is exactly the same for Real values.
I hope this explains the phenomenon.
-chris
From:
eLink Discussion: Development Discussion [mailto:development@elinkkc.opentext.com]
Sent:
Thursday, February 05, 2009 4:22 AM
To:
eLink Recipient
Subject:
Incorrect values returned by CAPI.Exec
Incorrect values returned by CAPI.Exec
Posted by
natgriuser3
(Gee, David) on 2009/02/05 05:18
We are facing a strange problem with CAPI.Exec.
We are trying to retrieve records using a simple SQL query. The value for the primary key (AMENDMENTID) is always returned with 'g' as a prefix. The same query in oracle behaves properly and does not prefix anything to the value.
Please advise.
Details –
Livelink version 9.2
Oracle Version – 9i
Please see attached the table structure