Distinct count to include blank values - crystal-reports

In the Running Total Fields, how do you set up a Distinct Count that includes blank values as one of your conditions?

Just found a solution. It's:
isnull({table.column})
Before asking, that's what I tried, but it wasn't working. So for people like me who tried that and it didn't work, that's because you have multiple conditions in your Running Total, and for whatever reason it only works when you edit your syntax and place that near the top of your conditions instead of the bottom. Don't know the reason, but it's working now.

I'd recommend replacing the field you're currently totaling with a new Formula. Something that doesn't ever come up blank, like:
If ISNULL {yourfieldhere} THEN "Blank" ELSE {yourfieldhere}
or if it's an empty string:
If {yourfieldhere}="" THEN "Blank" ELSE {yourfieldhere}
You can replace "Blank" with whatever suits you, even just an empty " " space or 0. But then it's at least something distinct to be counted.

Related

Should I use FIND function or use For Loop to search matching record

I am writing a function to search a record from sheet2 and return value to sheet1. I use the Find function and it works for most of the case. However, I encounter below issus.
The FIND function only support one matching key only. If I have more than one value to match, it didn't work.
Sometime, the search value may have space like "Key1 ". Then, if I search the word by "Key1", no record return. I can't use the wildcard search as I need exact match except the space.
To solve this, should I simply use a For loop to search the result instead of FIND? I have to loop through every row. I am not sure the performance is okay or not.
No related to FIND. As I need to copy the value as well as the backgroup color. I use the return cells.interior.colorindex to set the field. But the color is a little bit different. For example, the original is light green but it turn out to become darken color. I check both field has same colorindex. Any idea?
goodfit
Thanks,
see anyone has idea how to resolve it.

How to use OR condition in LibreOffice?

I am trying to use the formula below to set conditions in LibreOffice but I keep getting an error. What am I doing wrong with the statement below:
=IF(G2<=2,'negative',IF(OR(G2>2 & G2<=3,'neutral',IF(OR(G2>=4,'positive))))))
Thanks
It seems, that in your formula is missing the last ':
'positive))))))
should be 'positive'))))))
Also the
&
is string-concatenation in LibreOffice, so you need here the equivalent to OR() and that is AND().
But you can simplify your formula to
=IF(G2<=2,'negative',IF(AND(G2>2,G2<=3),'neutral','positive'))
The first test is if the number is lower than 2 (negative),
the second test is if the number is between 2 and 3 (neutral)
and then there is no further test needed as it is the only remainig possiblity.
For a different locale, a slightly shorter, and I'd say simpler, version that also avoids the need for OR/AND:
=IF(G2<=2,"negative",IF(G2<=3,"neutral","positive"))
Once <=2 first test is handled (either but outputting negative or by proceeding to the 'result if FALSE') there is no longer the possibility of 2 or less, so the AND is not necessary.
The above though does fill a gap left by OP between 3 and 4.

Sphinx exact match to column string

I thought that
Match('^Word$')
Would only find records that are exactly 'Word'
However although this does work for single words it does not for mutliple:
Match ('^Final Word$')
Finds 'Final Word' and 'Final and Last Word'.
as does
Match ('^"Final Word"$')
How do I tell Sphinx to only find an exact match?
Update: After some testing the best I can do is weighting/ranker and w/o ""
MATCH('^Final Word$') order by weight() desc limit 1 desc OPTION ranker=PROXIMITY_BM25
So I forced an exact match with ranking and limit, still would be nice to know how to actually say 'only return exact matches'.
One issue with above is if I do not have 'Final Word' in the table it will find all others e.g. 'Final and Last Word' which is behavior I do not want.
You just got your operators in wrong order :)
Match('"^Final Word$ "')
(having a space after $ helps with some mysterious sphinx bug!)
So the issue turned out to be that in my efforts to make this work one step had been to specify the ranker
Option Ranker=PROXIMITY_BM25
which had worked for me up to then. What actually works is
Match('^Final Word$')
and then not specifying ranker or specifying extended if the ranker in config is defined otherwise (it is extended by default).

Using text as condition in a while loop

Im having some trouble with using text as an condition for a while loop, currently the basic coding is:
result=struct('val','yes');
while result.val=='yes'
result.val=input('more digits?');
end
So as you see, what Im trying to do is keeping the loop going as long as the user types in 'yes'. But thats one of the probelmes I am having; Is there a way to get rid of the need to write the ''(e.g yes instead of 'yes')? Secondly, when I run the code it gives me the error message "Error using == ,Matrix dimensions must agree.". I realise this have to do with the word yes being longer than no, but I don't know how to fix it. It's not really an issue though considering its the the program ends anyway, but it is an annoyance I would like to get rid off.
To compare strings, use strcmp, or strcmpi to ignore case. It will handle comparison of different length strings. For example:
strcmpi(result.val,'yes')
If you want to search for a substring, such as just a 'y', at the beginning of the input, consider strncmpi (strncmpi(result.val,'y',1)) or just check the first character (result.val(1)).

What's so great about Block Selection Mode?

Longtime Eclipse user here; I recently discovered the "Block Selection Mode" (Alt-Shift-A) that was added into Eclipse 3.5. I tried it out, it's pretty neat--I can select a rectangle of text in my source code instead of selecting things a line at a time like I usually do.
Apparently this feature is common in other editors too, under other names like "column edit mode", etc. A lot of people seem to really love it, but I've got by without for a long time.
So my question is: What kinds of things is this feature useful for?
The only one I can think of is inserting a comment characters (like // or #) in front of a chunk of text. Also, I supposed if I had a bunch of variables names that were all lined up and I wanted to change the first characters for all of them at once. But surely there's more to it than that? I mean, when it comes to choosing an editor, this feature is apparently a deal-breaker for some people!
I find it is very useful when working with fixed-position field data files, and you only want to select a few fields for search-replace or copy-paste. It is also good for things like this:
call_foo('A',123);
call_foo('B',143);
call_foo('C',331);
call_foo('A',113);
call_foo('R',789);
The code is all the same except for some characters in some columns. You could select a block around the second parameter and search for the line containing 113. Useful when you have more than just a few lines all together in this format.
A colleague of mine told me of a project where they wrote JDBC code like this:
String query =
"select question, answer, accepted " +
"from so_answers " +
"where poster = 'Jon Skeet' " +
"order by upvotes ";
So that they could block-select the SQL in order to paste it into a database tool and run it by hand. Seems a bit barmy to me, but it evidently worked for them.
If you arn't using a block cut/copy/paste operation at least four or five times a day then I would suggest you're just doing a lot of extra typing.
If you are looking at a file with fixed width fields, sometimes you only want to select one column.