T O P I C R E V I E W |
maric001 |
Posted - 11/25/2014 : 11:34:23 AM Origin Ver. and Service Release (Select Help-->About Origin): 9.1 Operating System: win7 64
Hi there, i am building up a formula from my origin project:
win -o Formeln { page.active=2; loop(ss,1,wks.maxRows){ string Ref$=Col(2)[$(ss)]$; string Sig$=Col(3)[$(ss)]$; string RefIK$=Col(4)[$(ss)]$; string SigIK$=Col(5)[$(ss)]$; string RefITK$=Col(6)[$(ss)]$; string SigITK$=Col(7)[$(ss)]$; string RefMTK$=Col(8)[$(ss)]$; string SigMTK$=Col(9)[$(ss)]$; [Formeln]1!Col(2)[$(ss)]$="(((("+Sig$+"-"+SigIK$+")/("+Ref$+"-"+RefIK$+")"+"-"+SigITK$+")/(T1-"+RefITK$+")*1000000-"+SigMTK$+")/(T3-"+RefMTK$+")*1000"; }};
The script works so far, but since my data can contain negative values, i am ending up with something like this:
((((W66--10085,62259)/(W60--1545,35772)-2,37845)/(T1--55430,60782)*1000000--1,40652)/(T3-31328,2108)*1000
How to replace the double minus "--" with a single plus?
Cheers
Markus
|
1 L A T E S T R E P L I E S (Newest First) |
lkb0221 |
Posted - 11/26/2014 : 09:30:52 AM Hi, Markus
Modify the loop as following:
// Start // ... string SigMTK$=Col(9)[$(ss)]$; string Result$ = "(((("+Sig$+"-"+SigIK$+")/("+Ref$+"-"+RefIK$+")"+"-"+SigITK$+")/(T1-"+RefITK$+")*1000000-"+SigMTK$+")/(T3-"+RefMTK$+")*1000"; int nRet = Result.Replace("--", "-"); [Formeln]1!Col(2)[$(ss)]$ = Result$; // ... // End
The str.Replace will replace all "--" by "-".
Zheng OriginLab
|
|
|