nouislider rounding errors - nouislider

Here's my declaration in my angular 2 project:
<nouislider [connect]="true" [min]="2.79433548546" [max]="18.5525702846" [(ngModel)]="selectedRange" [tooltips]="[true, true]" ></nouislider>
Initially selectedRangeis correctly set to [2.79433548546, 18.5525702846]. However, as soon as I move the lower bound slider, numbers are rounded off so selectedRange becomes [2.79, 18.55]. 18.5525702846 is clearly not in this range so it is excluded from the sliding criteria. Any ideas of to avoid this?

Formatting to two decimals is the default. You can pass another formatter (using [format]="formatter" or [config]="config" in your declaration).
formatter or config.format would look like this:
format: {
to: String,
from: Number
}

Related

Changing String into Time

I need to change String in D column(example 28/10/2018:01:51:29) into Time format.
I've tried:
Format cells and make my own formating(dd/mm/yyyy:hh:mm:ss)
Data->Text to columns
But neither worked
Your issue is the colon : between the date and the time. Try this:
=TIMEVALUE(SUBSTITUTE(D1,":"," ",1))
This will return a number, like 0.077418981 which Excel can interpret as a time if you format the cell as time. If you want to skip this step and see the time as a string, use an additional TEXT function
=TEXT(TIMEVALUE(SUBSTITUTE(D1,":"," ",1)),"hh:mm:ss")
In Czech:
=ČASHODN(DOSADIT(D1,":"," ",1))
=TEXT(ČASHODN(DOSADIT(D1,":"," ",1)),"hh:mm:ss")
You may also need to swap commas , for semi-colons ; if your regional settings require it:
=ČASHODN(DOSADIT(D1;":";" ";1))
=TEXT(ČASHODN(DOSADIT(D1;":";" ";1));"hh:mm:ss")
Translations

Excel IF(AND) Statements

I have set up a betting worksheet with filters for date start / end, bet type, tipper, sports, leagues and variable.
The issue have that when I come create a formula referencing all of these filters, I get the "You've entered too many arguments in this function." error.
Before adding the Leagues filter, I started off with just date start / end, bet type, tipper, sports and variable filters and I had this formula which was working fine:
=IF(H12<>"",
IF(AND(FILT_D=1,FILT_T=1,FILT_B=1,FILT_C=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P"),
IF(AND(FILT_D>1,FILT_T=1,FILT_B=1,FILT_C=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE)),
IF(AND(FILT_D=1,FILT_T>1,FILT_B=1,FILT_C=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",CAPPER,OFFSET(AX$10,FILT_T,0)),
IF(AND(FILT_D=1,FILT_T=1,FILT_B>1,FILT_C=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_TYPE,OFFSET(AW$10,FILT_B,0)),
IF(AND(FILT_D=1,FILT_T=1,FILT_B=1,FILT_C>1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",CUSTOM,OFFSET(AY$10,FILT_C,0)),
IF(AND(FILT_D>1,FILT_T>1,FILT_B=1,FILT_C=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE),CAPPER,OFFSET(AX$10,FILT_T,0)),
IF(AND(FILT_D>1,FILT_T=1,FILT_B>1,FILT_C=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE),BET_TYPE,OFFSET(AW$10,FILT_B,0)),
IF(AND(FILT_D>1,FILT_T=1,FILT_B=1,FILT_C>1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE),CUSTOM,OFFSET(AY$10,FILT_C,0)),
IF(AND(FILT_D=1,FILT_T>1,FILT_B>1,FILT_C=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",CAPPER,OFFSET(AX$10,FILT_T,0),BET_TYPE,OFFSET(AW$10,FILT_B,0)),
IF(AND(FILT_D=1,FILT_T>1,FILT_B=1,FILT_C>1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",CAPPER,OFFSET(AX$10,FILT_T,0),CUSTOM,OFFSET(AY$10,FILT_C,0)),
IF(AND(FILT_D=1,FILT_T=1,FILT_B>1,FILT_C>1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_TYPE,OFFSET(AW$10,FILT_B,0),CUSTOM,OFFSET(AY$10,FILT_C,0)),
IF(AND(FILT_D>1,FILT_T>1,FILT_B>1,FILT_C=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE),CAPPER,OFFSET(AX$10,FILT_T,0),BET_TYPE,OFFSET(AW$10,FILT_B,0)),
IF(AND(FILT_D=1,FILT_T>1,FILT_B>1,FILT_C>1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",CAPPER,OFFSET(AX$10,FILT_T,0),BET_TYPE,OFFSET(AW$10,FILT_B,0),CUSTOM,OFFSET(AY$10,FILT_C,0)),
IF(AND(FILT_D>1,FILT_T=1,FILT_B>1,FILT_C>1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE),BET_TYPE,OFFSET(AW$10,FILT_B,0),CUSTOM,OFFSET(AY$10,FILT_C,0)),
IF(AND(FILT_D>1,FILT_T>1,FILT_B=1,FILT_C>1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE),CAPPER,OFFSET(AX$10,FILT_T,0),CUSTOM,OFFSET(AY$10,FILT_C,0)),
IF(AND(FILT_D>1,FILT_T>1,FILT_B>1,FILT_C>1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE),CAPPER,OFFSET(AX$10,FILT_T,0),BET_TYPE,OFFSET(AW$10,FILT_B,0),CUSTOM,OFFSET(AY$10,FILT_C,0)),
"")))))))))))))))),
"")
I then added a league filter into the mix and got the error. This is the amended formula containing the league filter (FILT_T).
=IF(P12<>"",
IF(AND(FILT_D=1,FILT_T=1,FILT_B=1,FILT_C=1,FILT_L=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P"),
IF(AND(FILT_D>1,FILT_T=1,FILT_B=1,FILT_C=1,FILT_L=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE)),
IF(AND(FILT_D=1,FILT_T>1,FILT_B=1,FILT_C=1,FILT_L=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",CAPPER,OFFSET(AX$10,FILT_T,0)),
IF(AND(FILT_D=1,FILT_T=1,FILT_B>1,FILT_C=1,FILT_L=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_TYPE,OFFSET(AW$10,FILT_B,0)),
IF(AND(FILT_D=1,FILT_T=1,FILT_B=1,FILT_C>1,FILT_L=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",CUSTOM,OFFSET(AY$10,FILT_C,0)),
IF(AND(FILT_D=1,FILT_T=1,FILT_B=1,FILT_C=1,FILT_L>1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",LEAGUES,OFFSET(AZ$10,FILT_L,0)),
IF(AND(FILT_D>1,FILT_T>1,FILT_B=1,FILT_C=1,FILT_L=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE),CAPPER,OFFSET(AX$10,FILT_T,0)),
IF(AND(FILT_D>1,FILT_T=1,FILT_B>1,FILT_C=1,FILT_L=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE),BET_TYPE,OFFSET(AW$10,FILT_B,0)),
IF(AND(FILT_D>1,FILT_T=1,FILT_B=1,FILT_C>1,FILT_L=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE),CUSTOM,OFFSET(AY$10,FILT_C,0)),
IF(AND(FILT_D>1,FILT_T=1,FILT_B=1,FILT_C=1,FILT_L>1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE),LEAGUES,OFFSET(AZ$10,FILT_L,0)),
IF(AND(FILT_D=1,FILT_T>1,FILT_B>1,FILT_C=1,FILT_L=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",CAPPER,OFFSET(AX$10,FILT_T,0),BET_TYPE,OFFSET(AW$10,FILT_B,0)),
IF(AND(FILT_D=1,FILT_T>1,FILT_B=1,FILT_C>1,FILT_L=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",CAPPER,OFFSET(AX$10,FILT_T,0),CUSTOM,OFFSET(AY$10,FILT_C,0)),
IF(AND(FILT_D=1,FILT_T>1,FILT_B=1,FILT_C=1,FILT_L>1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",CAPPER,OFFSET(AX$10,FILT_T,0),LEAGUES,OFFSET(AZ$10,FILT_L,0)),
IF(AND(FILT_D=1,FILT_T=1,FILT_B>1,FILT_C>1,FILT_L=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_TYPE,OFFSET(AW$10,FILT_B,0),CUSTOM,OFFSET(AY$10,FILT_C,0)),
IF(AND(FILT_D=1,FILT_T=1,FILT_B>1,FILT_C=1,FILT_L>1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_TYPE,OFFSET(AW$10,FILT_B,0),LEAGUES,OFFSET(AZ$10,FILT_L,0)),
IF(AND(FILT_D>1,FILT_T>1,FILT_B>1,FILT_C=1,FILT_L=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE),CAPPER,OFFSET(AX$10,FILT_T,0),BET_TYPE,OFFSET(AW$10,FILT_B,0)),
IF(AND(FILT_D=1,FILT_T>1,FILT_B>1,FILT_C>1,FILT_L=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",CAPPER,OFFSET(AX$10,FILT_T,0),BET_TYPE,OFFSET(AW$10,FILT_B,0),CUSTOM,OFFSET(AY$10,FILT_C,0)),
IF(AND(FILT_D=1,FILT_T=1,FILT_B>1,FILT_C>1,FILT_L>1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_TYPE,OFFSET(AW$10,FILT_B,0),CUSTOM,OFFSET(AY$10,FILT_C,0),LEAGUES,OFFSET(AZ$10,FILT_L,0)),
IF(AND(FILT_D>1,FILT_T=1,FILT_B>1,FILT_C>1,FILT_L=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE),BET_TYPE,OFFSET(AW$10,FILT_B,0),CUSTOM,OFFSET(AY$10,FILT_C,0)),
IF(AND(FILT_D>1,FILT_T=1,FILT_B>1,FILT_C>1,FILT_L>1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE),BET_TYPE,OFFSET(AW$10,FILT_B,0),CUSTOM,OFFSET(AY$10,FILT_C,0),LEAGUES,OFFSET(AZ$10,FILT_L,0)),
IF(AND(FILT_D>1,FILT_T>1,FILT_B=1,FILT_C>1,FILT_L=1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE),CAPPER,OFFSET(AX$10,FILT_T,0),CUSTOM,OFFSET(AY$10,FILT_C,0)),
IF(AND(FILT_D>1,FILT_T>1,FILT_B=1,FILT_C>1,FILT_L>1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE),CAPPER,OFFSET(AX$10,FILT_T,0),CUSTOM,OFFSET(AY$10,FILT_C,0),LEAGUES,OFFSET(AZ$10,FILT_L,0)),
IF(AND(FILT_D>1,FILT_T>1,FILT_B>1,FILT_C>1,FILT_L>1),SUMIFS(AT_RISK,SPORT,H12,WIN,"<>P",BET_DATE,">="&DATE(OFFSET(BA$11,FILT_YS,0),FILT_MS,FILT_DS),BET_DATE,"<="&DATE(OFFSET(BA$11,FILT_YE,0),FILT_ME,FILT_DE),CAPPER,OFFSET(AX$10,FILT_T,0),BET_TYPE,OFFSET(AW$10,FILT_B,0),CUSTOM,OFFSET(AY$10,FILT_C,0),LEAGUES,OFFSET(AZ$10,FILT_L,0)),
"")))))))))))))))))))))),
"")
Can anyone shed light on what I'm doing wrong?
You can only have a maximum of 255 cell referenced or indeed numbers referred to in a formula. The following has 255 ones and it works fine, adding an additional one will give you the error
=IF(AND(1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1);"t";"f")

Ampscript BuildRowsetFromString() fails on single item

I've been tasked with an ExactTarget task, which uses Ampscript. Trying to learn on the go here. See code snippet below:
%%[
Var #testString, #testOutput
Set #testString = Qwerty
Set #testOutput = BuildRowsetFromString(#testString,"~")
]%%
TestOutput:%%= v(#testOutput) =%%
The code works if the testString contains a ~, but when there is no ~ character in the string, the ouput is blank. Is this correct by design? Do I need to add a conditional to check for the presence of the ~ character?
That's the expected behavior. The BuildRowsetFromString() function alone isn't going to return any value when displayed, you're going to need to use Row() and Field() in order to pull the value out.
Using your example:
%%[
Var #testString, #testOutput
Set #testString = "Qwerty"
Set #testOutput = BuildRowsetFromString(#testString,"~")
]%%
RowCount: %%=RowCount(#testOutput)=%%
TestOutput: %%=v(#testOutput)=%%
The RowCount() function returns a value of 1, essentially saying it knows there's at least one 'row' in there. To display that one value, you'll need to wrap that value with Field() and Row():
TestOutput: %%=Field(Row(#testOutput,1),1)=%%
If you want to display other values in the string, say you were passing "Qwerty~Second~Third", you'll need to either change the number at the Row() function or perform a loop.
References
Using Loops
BuildRowsetFromString() Function

Why doesn't my RangeEditor work, when I use mode='spinner'?

In a HasTraits subclass, I have the following Trait defined:
tx_lane_sel = Range(0, 12)
If I display it in my View, using:
Item('tx_lane_sel')
it works as expected, displaying a slider bar, which ranges from 0 to 12.
However, if I try to display it, using:
Item('tx_lane_sel', editor=RangeEditor(mode='spinner'))
the resultant spinner only offers me choices '0' and '1'!
How do I get the spinner working correctly? That is, how do I get it to offer me the full range [0, 12]?
The RangeEditor is not especially ment for Range traits. Thus, as for integers or floats, you need to specify the range by using the low=0, high=12 or the low_name or high_name editor factory attributes:
Item("tx_lane_sel", editor=RangeEditor(low=0, high=12, mode='spinner'))

XLL issue with xlfEvaluate

I have this problem with a very simple function written in an XLL, using VS2012. I have tried reading up in MSDN and Steve Dalton's book, and I cannot see what I am doing wrong.
The tricky bit is that I need my function to read values in worksheet cells other than the one from which it is called. The function takes no arguments, and returns an integer. I have declared it as J# (the # signifying that it can call XLM functionality as advised by Dalton...although I still get the same problem without the #). I have not included the declaration of my function to save space, but it is simple and I do not think it is the cause of the problem.
This first block of code works fine. I wrote it just to build confidence.
//This block works correctly. A trial copied from the old Excel 97 documentation
XLOPER12 xlInput1, xlOutput2;
/* Evaluate the string "2+3" */
xlInput1.xltype = xltypeStr;
xlInput1.val.str = L"\0032+3"; //prefix with string length in Octal
Excel12(xlfEvaluate, &xlOutput2, 1, (LPXLOPER12) &xlInput1);
//works OK, and xlOutput2 contains 5
But this second block does not work. I cannot see why. I am trying to read a value from a cell, which is a different cell from that from which the function was called. What I get is an return XLOPER12 that contains an error (xltypeErr) and junk values in the val.num field (the worksheet cell does contain an integer value).
//This block does not work
XLOPER12 xlInput3, xlOutput3;
/* Look up the name Tst on the active sheet called Sht */
xlInput3.xltype = xltypeStr;
xlInput3.val.str = L"\003Tst"; //this also gives problems regardless of whether the string is defined as \004!Tst or \007Sht!Tst
Excel12(xlfEvaluate, &xlOutput3, 1, (LPXLOPER12) &xlInput3); //xlOutput3 now has a type of xltypeErr, rather than the correct integer value on the worksheet
Can you kindly explain what is going wrong?
If you're trying to read a value from a cell that is different from the cell calling the function you'll need a parameter to refer to that different cell. For example in A1 you may have '=myfunc(A2)'. Then your C++ extension func will need to be declared 'JP#', with the P corresponding to the A2 cell reference parameter. If Excel can resolve the 'A2' reference it will pass in an XLOPER with that value as xltypeNum, xltypeInt or xltypeStr depending on the the contents of A2. If not you may get an xltypeSRef.
xlfEvaluate: here's the MS doc https://msdn.microsoft.com/en-us/library/office/bb687913(v=office.15).aspx
Note that MS specify that the string passed to xlfEvaluate must 'contain only functions, not command equivalents'. I suspect L"\003Tst" doesn't correspond to any function known to your Excel. There's no built in function called Tst in my Excel 2013. It's possible you have an addin that supplies a function called Tst, but I'm guessing not. So try changing xlInput3.val.str to L"\006RAND()" and see what happens.

Resources