Group by formula field in report - crystal-reports

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

Related

Count when 2 columns are empty on QlikSense

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.

Ssrs expression returns #error when I open my report and see the total

=if(Fields!Type6.Value="S","",Sum(Fields!Col6.Value))
this is above is a expression which i used for a Sum of column which don't Contains "S"
What I have tried:
this Expression return #Error
Hide Copy Code
if(Fields!Type6.Value="S","",Sum(Fields!Col6.Value))
This Works Fine But it will sum up also alphanumeric column numeric characters
Hide Copy Code
if(Fields!Type6.Value="S","",Val(Sum(Fields!Col6.Value)))
i have used dynamic column so i don't know which is numeric column or string
so plz help me to out from this
By entering "" and a sum you are causing SSRS to try and add a string and a number. Change it to
=if(Fields!Type6.Value="S",cint(0),Sum(Fields!Col6.Value))
or
=if(Fields!Type6.Value="S",cdec(0),Sum(Fields!Col6.Value))

Split string into two parts and concatenate with another column

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.

Total function does not compile

I am trying to provide a total of all outstanding voucher amounts.
In one place I have this code:
=DSum("[Voucher_Balance]"|"tblVoucherInfo"|"[Patient_number] = " & [No])
I try to mimic this code at the end of the page but it gives an error.
'the expression you entered has invalid vertical bars'
Is there any way to fix this? We want to show the total of voucher balance per each patient.
I have tried changing the 'Region and LAnguage' list separator on the PC to a comma but that has no effect.
i tried changing the | to a comma, !, . - all to no effect.
Remove those bars:
=DSum("[Voucher_Balance]","tblVoucherInfo","[Patient_number] = " & [No] & "")
If that doesn't sum, your field names or table are misspelled, or no valid value for [No] is passed.

#Crystalreports extract a string from a column

I have situation in Crystal reports 11 , where I want to extract string from a particular column which is delimited.
Here is the Example within "":
"06DEC2016 Status
-10, 11, 13
-Parts provided sketches to Bus
-Bus needs to confirm the speed changes and the exact locations
-This change has cost implications and must be recompensed by Bus
-Parts will provide cost proposal
&BIC: Farmer&"
I want to extract everything before the first & delimiter.
Please help me. Thanks
Split (your_text, "&")[1]
It will split the text for each occurrence of "&", returning an array.
For example, for the text "aaa&bbb&c", it would result in the array ["aaa", "bbb", "c"]. Note that for Crystal, the first index is 1.