Loading SAP Negative values via TI

Post Reply
digger1914
Posts: 6
Joined: Thu Jun 05, 2008 3:34 am

Loading SAP Negative values via TI

Post by digger1914 »

We are just moving to a SAP payroll system, and it produces negative values with the sign at the end, ie 2.365- instead of -2.365.

Does anyone have any brilliant idead for loading this via TI? I currently get a warning telling me that it cannot the value to a real number.

Thanks
Alan Kirk
Site Admin
Posts: 6664
Joined: Sun May 11, 2008 2:30 am
OLAP Product: TM1
Version: PA2.0.9.18 Classic NO PAW!
Excel Version: 2013 and Office 365
Location: Sydney, Australia
Contact:

Re: Loading SAP Negative values via TI

Post by Alan Kirk »

digger1914 wrote:We are just moving to a SAP payroll system, and it produces negative values with the sign at the end, ie 2.365- instead of -2.365.

Does anyone have any brilliant idead for loading this via TI? I currently get a warning telling me that it cannot the value to a real number.
Best option is to get the SAP DBA / Guru to fix the export format. Failing that there's always something like this. (The real variable is of course defined as String on the variables tab):

Code: Select all

# Let's pretend that...
s_StringVariable = '3.25-';

# Check whether the last character is a - sign...
If ( Subst ( s_StringVariable, Long ( s_StringVariable), 1 ) @= '-');
    dbl_Multiplier = -1;
    s_StringVariable = Subst ( s_StringVariable, 1, Long ( s_StringVariable) -1 );
Else; 
    dbl_Multiplier = 1;
EndIf;

dbl_NumericVariable = StringToNumber ( s_StringVariable ) * dbl_Multiplier;
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
digger1914
Posts: 6
Joined: Thu Jun 05, 2008 3:34 am

Re: Loading SAP Negative values via TI

Post by digger1914 »

Thanks Alan for the prompt reply,

I had exactly the same thought a minute after posting. I went with


## Look for negative value entitlements with trailing sign

IF(SUBST(LSL_Hours_Ent,LONG(LSL_Hours_Ent),1) @= '-');
LSL_Hours_Ent_Calc = '-'|SUBST(LSL_Hours_Ent,1,LONG(LSL_Hours_Ent)-1);
LSL_Hours_Ent_Load = StringToNumber(LSL_Hours_Ent_Calc);
ELSE;
LSL_Hours_Ent_Load = StringToNumber(LSL_Hours_Ent);
ENDIF;
Post Reply