I need some help to count the number of line empty in 2 columns on QlikSense formula.
In the example, when the column "Item" is filled, I would like to count the number of lines which have both "Info 1" and "Info 2" empty.
In this case it should be 2 (Line B and Line E).
Does anybody know how to do this formula?
Many thanks,
Wil
I found this post with the solution.
Related
I am trying to get pallet tickets printed. I have a stored field {Paperdetails.TotalPalletCount} that is the total number of pallets, ie the number of labels I need.
I have a loop
LOCAL NUMBERVAR i :=1;
WHILE i < {Paperdetails.TotalPalletCount}
DO
(i = i+1)
but I get the error
A loop was evaluated more than the max number of time allowed
Any help appreciated
Ewan
The last line is not assigning a new value to i but is comparing it to i+1.
Just change the last line as follows (notice the colon :)
(i := i+1)
It should also be noted that loops in Crystal Reports may be evaluated a maximum of 100'000 times.
My string columns look like this:
Name : AllenEdward
UniqID : 12345678
How can I get this output in my report?
Allen12345678 Edward
12345678 should be followed by 2 spaces.
The first thing to figure out the formulas that split the Name column. We don't know what your data looks like, so that's all you. You could write something that adds a space before any capital letters after the first, but you'll have trouble with the more complex last names like MacDonald.
Once you figure that out, it's a simple matter of using Formula Fields in Crystal. Something like:
[FIRST]{table.UniqID} & " " & [LAST]
...where [FIRST] and [LAST] are the results from your splitting formula.
To start from the beginning I had a long memo line that I needed to strip down to only show me a specific name in the string. Here is an example of the original memo line my report was giving me:
Ex. PLUMBERS-ACH distribution from share suffix 9 [2] 19.00 01DEC2017
I created three different formulas to strip down the memo line to only show me text before the "-". Here are those formulas:
Formula 1:
Left({SH_HIST.trn_memo}, instr(1,{SH_HIST.trn_memo},"-")-1)
Formula 2:
replace({Formula 1}, "-", " ")
Formula 3:
If instr({SH_HIST.trn_memo}, "-")>0 then {#Formula 2} else {SH_HIST.trn_memo}
I then placed Formula 3 into the report to give me the desired output from the memo line (this returns output successfully). Now I need to sort by that field because I need to be able to group all like items and sum them. When I click on "Insert Group" and select Formula 3 then try to preview the report I get the following message:
string length is less than 0 or not an integer
Can anyone lead me in the right direction to fix this, please? I've googled my heart out.
Instead of 3 formulas why don't you try this:
Split(Column,"-")[1] //Provided the format you gave applies for all records
Now group by this formula
I need to take a pipe that has a column of labels with associated values, and pivot that pipe so that there is a column for each label with the correct values in each column. So f example if I have this:
Id Label Value
1 Red 5
1 Blue 6
2 Red 7
2 Blue 8
3 Red 9
3 Blue 10
I need to turn it into this:
ID Red Blue
1 5 6
2 7 8
3 9 10
I know how to do this using the pivot command, but I have to explicitly know the values of the labels. How can I can dynamically read the labels from the “label” column into a list that I can then pass into the pivot command? I have tried to create list with:
pipe.groupBy('id) {_.toList('label) }
, but I get a type mismatch saying it found a symbol but is expecting (cascading.tuple.Fields, cascading.tuple.Fields). Also, from reading online, it sounds like using toList is frowned upon. The number of things in 'label is finite and not that big (30-50 items maybe), but may be different depending on what sample of data I am working with.
Any suggestions you have would be great. Thanks very much!
I think you're on the right track, you just need to map the desired values to Symbols:
val newHeaders = lines
.map(_.split(" "))
.map(a=>a(1))
.distinct
.map(f=>Symbol(f))
.toList
The Execution type will help you to combine with the subsequent pivot, for performance reasons.
Note that I'm using a TypedPipe for the lines variable.
If you want your code to be super-concise, you could combine lines 1 & 2, but it's just a stylistic choice:
map(_.split(" ")(1))
Try using Execution to get the list of values from the data. More info on executions: https://github.com/twitter/scalding/wiki/Calling-Scalding-from-inside-your-application
I am trying to create a table of symbols in kdb, where the values of the table have spaces within. I have got
tab:([colOne:`$"value 1"`$"value 2"]colTwo:`$"value 3"`$"value 4")
currently, but this just returns
ERROR: `type (wrong type)
i have followed http://www.kdbfaq.com/kdb-faq/tag/sym-with-a-space
Should be:
tab:([colOne:`$("value 1";"value 2")]colTwo:`$("value 3";"value 4"))
Remember that evaluation in q is left-to-right:
colTwo:`$"value 3"`$"value 4"
`$"value 4" will be evaluated to symbol
Then it will try to apply this symbol to what's on the left:
"value 3" `$"value 4"
which will give you 'type
you are right about sym with a space part but while creating a table columns take lists as inputs.
tab:([colOne:`a`b]colTwo:`c`d)
would be ok as `a`b is a list but when using syms with spaces you need to enclose them in () to make a list.
below will also work though sergey's answer is a better way of doing it.
tab:([colOne:(`$"value 1";`$"value 2")]colTwo:(`$"value 3";`$"value 4"))