[CR integrated in VS 2005] - sum of string fields
Hello,
i am discovering CR,
and i am trying to do the sum of a field (number) but declared as string. the declaration of the field cannot be changed (string in the database).
so i want to do the sum of this field.
i wonder if it is possible, and if yes, how.
maybe something like a formula.
I saw the functions: ToNumber () and Cdbl() for conversion, and Sum().
If someone has an idea, i will be very interested.
PS: sorry if my question is not understandable, i'm french. If you don't understand it, i would rewrite it.
thank you!
thank you.
I could convert, but the problem is to make the sum of the conversion.
i would like to do something like:
Sum(ToNumber ()) but CR does not accept it.
Maybe by using a variable in a formula (but i don't know where):
shared numbervar total;
total = total+ToNumber({MyField});
and when printing a formula field at the bottom of the report to show the total:
shared numbervar total;
ToText (total);
Similar Messages
-
Add a carriage return in a Unbound String Field
Post Author: Razzle00
CA Forum: Formula
Hi,
How can I add a carriage return to an unbound string field in a crystal report. I am using the bundled version of CR with MS Visual Studio 2003 & 2005. My formula needs to look something like this....
'Heading One:' + CARRIAGE RETURN + trim({tablename.fld_1}) + CARRIAGE RETURN + 'Heading Two:' + CARRIAGE RETURN + trim({tablename.fld_2})
this code all needs to be in 1 unbound string field. Is this possible?
Thanks,
RazzlePost Author: SKodidine
CA Forum: Formula
To add a carriage return, add CHRW(13)
For example:
'Heading One:' & chrw(13) & 'sample text';
will result in:
Heading One:
sample text -
How to calculate sum of the fields in adobeforms
Hello Experts
can i know how to calculate sum of fields in the adobe form. I have few fields to be summed in total field.
RegardsHello Surendra,
Suppose you are having 4 fields and the 4th field is the TOTAL field.
Write the below Javascript on the Initialize event of TOTAL field as shown below.
Remember that if you use just "+" sign without Number() or ParseInt() function it acts like String Concatenation.
this.rawvalue = Number( this.parent.field1.rawvalue ) +
Number( this.parent.field2.rawvalue ) +
Number( this.parent.field3.rawvalue ) ;
You can also write is as shown below.
this.rawvalue = parseInt( this.parent.field1.rawvalue ) +
parseInt( this.parent.field2.rawvalue ) +
parseInt( this.parent.field3.rawvalue ) ; -
How to Aggregate String Fields
Hi
I have a Query in which i Use Sum to aggregate fields , now i have some new fields on the table which are String, i want to add those to same existing queries where Sum is happening. and i want those string values to get aggregated as well like for rows
where sum is happening for same rows i want a concatenated value for string field
like i have two rows
Field 1 (int) -- Field 2(string)
Row 1: 1 'abc'
Row 2: 2 'xyz'
When I aplly Sum(Field1) it returns 3 and i want to get back 'abc,xyz' for Field 2 is there a function there SQL which i can use ?
or any work around in SQLHi,
This concatinates all the rows , i need only those rows concatinated which sumed up toagather basesd upon group by caluse, so if have a group by clause on Field 3 then i would like to see result as Two resultant rows
Row 1: Field1 = 3 and Field2 = 'abc,xyz'
Row 2: Field1 = 7 and Field2 = 'JGG,AA'
is there a way to do this
Field 1 (int) -- Field 2(string) Field3
Row 1: 1 'abc' 1
Row 2: 2 'xyz' 1
Row 3: 3 'JGG' 2
Row 4: 4 'AA' 3 -
Hi,
Length of string fields in my crystal report are locked to 20 by default, but my data source's query's field length is 50. How can I fix the crystal report to show all 50 characters in the report?
Thanks and regards,
AlHi Hitesh and Crystalier,
Thanks for your replies.
I check marked "Can Grow" option and it didn't work.
Database is SQL Server 2005 and my connection is OLE DB (ADO). The database field is VARCHAR(50).
I noticed, under the Field Explorer --> Database Fields, the type of the field is showing as "String [20]". But the field in the datasource (SQL Server 2005) is Varchar(50). Also, when I right-clicked Browse Data on the field on Field Explorer, the data that was returned are all trimmed to 20 characters.
Thanks and regards,
Al -
Post Author: Jedit
CA Forum: General
I need a total sum for a shared number variable let me explain.
I have jobs (JWO-1,JWO-2 JWO-3 etcu2026..) that have items being scrapped at different operations.
I have a main report that shows all jobs with scrap & has two sections in it, detail section A & B.
My sub report is located in section A with the following fields
JOB | OP | QTY_SCRAP | COST.
The sub report lists all lines (operations) that have been completed for a job & filters on QTY_SCRAP being >0 then sums the cost filed for all completed operations up to the operation the item/s were scrapped.
I have a shared numbervar (linetotal) that Iu2019m using to pass the summed value back to my main report.
Syntax for variable is
whileprintingrecords;shared numbervar linetotal:=Sum ({table.Cost})
Back in my main report in detail section B.
I have some other fields that describes why the item/s were found to be faulty with a cost centre, the linetotal field from the sub report appears here & I reference it up with variable linetotal in my main report as
whileprintingrecords;shared numbervar linetotal
For any job, my report shows items being scraped at different operations with a cost & a reason for the scrap.
I now grouped on a Job Number & try to sum all the linetotal parameter fields.
Itu2019s at this point I have the difficulty?
I also want to use the values in a chart & have the same problem, the field is not available for a chart & canu2019t be summed????
I know itu2019s a bit verse & chapter but hopefully this will help?Dear Gary,
IMHO we can't use a structure type as a parameter ,
especially when the structure does not consist of string fields only.
This is the case why there is the need to define several select-options in the selection screen pointing to the same table ( ie : s_vbeln for vbak-vbeln, s_auart for vbak-auart ) .
In case of yours, if the parameter has a basic type, then the internal table definition should be just fine .
====
I have just read this thread again and find out that your requirement is to define a dynamic table .
In that case, you can ignore this reply
Rgds,
Tuwuh Sih Winedya
Message was edited by:
TUWUHSIH WINEDYA -
Hello Guys,
I'm using 'REUSE_ALV_GRID_DISPLAY' in my prog.
There is a field in output table which is of type P(8) Decimals 3.
When I'm trying to get the sum of this field in ALV Display it gives the message " Desired operation cannot be performed for column 'Converted Quantity' ".
I have also tried do_sum = 'X'.
But it is not working. Please help guys.
Regards,
AbhinavThanks a lot guys for your inputs.
The program is working now.
Now I'm using :
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = 'QUAN'.
* wa_fieldcat-ref_tabname = 'I_OUT2'.
* wa_fieldcat-tabname = 'I_OUT2'.
wa_fieldcat-qfieldname = 'MEAS'.
wa_fieldcat-qtabname = 'I_OUT2'.
wa_fieldcat-outputlen = '15'.
wa_fieldcat-seltext_l = text-052.
APPEND wa_fieldcat TO i_fieldcat.
The program is working fine now.
I have commented tabname and -ref_tabname , and the program is working fine now.
Thanks a lot. -
Dump when summing up CURR field in ALV GRID display
Hi All,
I am getting dump when I try to sum the CURR field in my ALV Grid Display. The field is of CURR 23. I am using classes and methods to display alv grid.
I tried passing <fs_fieldcat>-do_sum = 'X'. When I did this, it is dumping without even displaying the alv grid.
Here is the part it is throwing dump:
ls_lvc_data-value = space.
clear ls_lvc_data-style.
loop at it_fcat_local assigning <ls_fcat>
where tech ne 'X' and no_out ne 'X'.
if l_invisible eq 'X'.
clear l_invisible.
if <ls_fcat>-do_sum is initial.
continue.
else.
clear ls_lvc_data-col_pos.
endif.
endif.
add 1 to ls_lvc_data-col_pos.
assign component <ls_fcat>-fieldname
of structure <ls_data> to <l_field_value>.
_if sy-subrc ne 0.
message x000(0k).
endif._
Regards,
GuruThomas,
Here is the dump:
Runtime Errors MESSAGE_TYPE_X
Date and Time 10/22/2010 23:30:53
Short text
The current application triggered a termination with a short dump.
What happened?
The current application program detected a situation which really
should not occur. Therefore, a termination with a short dump was
triggered on purpose by the key word MESSAGE (type X).
Error analysis
Short text of error message:
Long text of error message:
Technical information about the message:
Message class....... "0K"
Number.............. 000
Variable 1.......... " "
Variable 2.......... " "
Variable 3.......... " "
Variable 4.......... " "
How to correct the error
Probably the only way to eliminate the error is to correct the program.
If the error occures in a non-modified SAP program, you may be able to
find an interim solution in an SAP Note.
If you have access to SAP Notes, carry out a search with the following
keywords:
"MESSAGE_TYPE_X" " "
"SAPLSLVC" or "LSLVCF36"
"FILL_DATA_TABLE"
If you cannot solve the problem yourself and want to send an error
notification to SAP, include the following information:
1. The description of the current problem (short dump)
To save the description, choose "System->List->Save->Local File
(Unconverted)".
2. Corresponding system log
Display the system log by calling transaction SM21.
Restrict the time interval to 10 minutes before and five minutes
after the short dump. Then choose "System->List->Save->Local File
(Unconverted)".
3. If the problem occurs in a problem of your own or a modified SAP
program: The source code of the program
In the editor, choose "Utilities->More
Utilities->Upload/Download->Download".
4. Details about the conditions under which the error occurred or which
actions and input led to the error.
Source Code Extract
Line
SourceCde
2708
is_subtottxt_info = ls_subtot_info
2709
ip_subtot_line = lr_data
2710
changing
2711
c_subtottxt = l_subtottxt.
2712
ls_lvc_data-value = l_subtottxt.
2713
2714
append ls_lvc_data to ct_lvc_data.
2715
endif.
2716
2717
2718
Column per Fieldcat Entry
2719
2720
ls_lvc_data-value = space.
2721
clear ls_lvc_data-style.
2722
loop at it_fcat_local assigning <ls_fcat>
2723
where tech ne 'X' and no_out ne 'X'.
2724
if l_invisible eq 'X'.
2725
clear l_invisible.
2726
if <ls_fcat>-do_sum is initial.
2727
continue.
2728
else.
2729
clear ls_lvc_data-col_pos.
2730
endif.
2731
endif.
2732
2733
add 1 to ls_lvc_data-col_pos.
2734
2735
assign component <ls_fcat>-fieldname
2736
of structure <ls_data> to <l_field_value>.
2737
if sy-subrc ne 0.
>>>>>
message x000(0k).
2739
endif.
2740
2741
*... work on average
2742
if <ls_fcat>-do_sum eq 'C'.
2743
Initialize average result and entries
2744
<l_field_value> = 0.
2745
clear l_entries.
2746
2747
retrive unit from fieldcatalog
2748
assign space to <l_unit>.
2749
if not <ls_fcat>-cfieldname is initial.
2750
assign component <ls_fcat>-cfieldname
2751
of structure <ls_data> to <l_unit>.
2752
endif.
2753
if not <ls_fcat>-qfieldname is initial.
2754
assign component <ls_fcat>-qfieldname
2755
of structure <ls_data> to <l_unit>.
2756
endif.
2757 -
Hello Guys,
CAn any one tell me how to do the SUM for a particular column in ALV.It should display at the End of the records.The column field is TYPE N(4).
My CODE is like this:
CLEAR fc_tmp.
fc_tmp-col_pos = 5.
fc_tmp-reptext_ddic = 'POINTS'.
fc_tmp-fieldname = 'POINTS'.
fc_tmp-tabname = 'ITAB'.
fc_tmp-outputlen = 15.
fc_tmp-key = 'X'.
fc_tmp-do_sum = 'X'.
APPEND fc_tmp TO fieldcat.
This is not working.
Thanks in Advance,
Take careHi,
populate the IT_SORT internal table of REUSE_ALV_GRID_DISPLAY provided in the importing parameters.
fieldname = Company Code
append fieldname to it_sort.
fieldname = division.
append fieldname to it_sort.
If you explicitly need subtotals then add the following line
subtot = 'X'
For obtaining sum you have an attribute "do_sum" in fieldcatalog , set it to 'X' and you should be able to do sum on that field.
<b>Ensure that these should be numeric / currency or quantity datatypes only.</b>
wa_fieldcat-datatype = 'CURR'. or
wa_fieldcat-datatype = 'QUAN'.
Hope this solves your problem
Cheers,
Simha.
PS : Please reward points if solution is helpful -
Material description filled automatically as the sum of two fields
Hello to all
We can automate the process of the creation a new material doing that the field material description(MAKT-MAKTX) can be filled by the system before saving(not by the user) as the sum of two fields in the MARA table that the users will be filled manually.
Is it possible using a user exit, field exit,....?
Thanks in advance.
RegardsHello to all
We can automate the process of the creation a new material doing that the field material description(MAKT-MAKTX) can be filled by the system before saving(not by the user) as the sum of two fields in the MARA table that the users will be filled manually.
Is it possible using a user exit, field exit,....?
Thanks in advance.
Regards -
A record selection problem with a string field when UNICODE database
We used report files made by Crystal Reports 9 which access string fields
(char / varchar2 type) of NON-UNICODE database tables.
Now, our new product needs to deal with UNICODE database, therefore,
we created another database schema changing table definition as below.
(The table name and column name are not changed.)
char type -> nchar type
varchar2 type -> nvarchar2 type
When we tried to access the above table, and output a report,
the SQL statement created from the report seemed to be wrong.
We confirmed the SQL statement using Oracle trace function.
SELECT (abbr.) WHERE "XXXVIEW"."YYY"='123'.
We think the above '123' should be N'123' because UNICODE string
is stored in nchar / nvarchar2 type field.
Question:
How can we obtain the correct SQL statement in this case?
Is there any option setting?
FYI:
The environment are as follows.
Oracle version: 11.2.0
ODBC version: 11.2.0.1
National character set: AL16UTF16With further investigating, we found patterns that worked well.
Worked well patters:
Oracle version: 11.2.0
ODBC version: 11.2.0.1
National character set: AL16UTF16
Report file made by Crystal Reports 2011
Crystal Reports XI
Not worked patters:
Oracle version: 11.2.0 (same above)
ODBC version: 11.2.0.1 (same above)
National character set: AL16UTF16 (same above)
Report file made by Crystal Reports 2011 (same above)
Crystal Reports 2008 / 2011
We think this phenomenon is degraded behavior of Crystal Reports 2008 / 2011.
But we have to use the not worked patters.
Anything wrong with us? Pls help.
-Nobuhiko -
Edirectory ldap, what do I put in the DN String field?
Experts,
I am trying to configure LDAP authentication. I've done this many, many times against Active Directory. In AD it is usually DOMAIN_NAME\%LDAP_USER%.
This has been driving me nuts today. We are running eDirectory. I have my server's IP address and port.
What do I put in the DN String field? I've tried many combinations of TREENAME\%LDAP_USER%, nothing seems to work.
If it is more complicated than that, where do I look in NDS to figure out what I need to put in the DN String field?
Thanks!
DanDan,
I'm actually surprised you had success with that on AD as I never did. I recommend you get a little lower level and use DBMS_LDAP. Here's a little sample code to get you started:
FUNCTION ldap_authenticate (
p_username IN VARCHAR2
, p_password IN VARCHAR2
RETURN BOOLEAN
AS
l_dn VARCHAR2(256) := p_username || '@domain.com';
l_bind PLS_INTEGER;
l_session DBMS_LDAP.SESSION;
BEGIN
IF p_username IS NULL
THEN
RAISE_APPLICATION_ERROR(-20001,'A username must be supplied');
END IF;
IF p_password IS NULL
THEN
RAISE_APPLICATION_ERROR(-20002,'A password must be supplied');
END IF;
dbms_ldap.use_exception := TRUE;
l_session := dbms_ldap.init(
hostname => 'server.domain.com'
, portnum => 389
l_bind := dbms_ldap.simple_bind_s(
ld => l_session
, dn => l_dn
, passwd => p_password
l_bind := dbms_ldap.unbind_s(l_session);
RETURN TRUE;
EXCEPTION
WHEN OTHERS
THEN
RETURN FALSE;
END;Regards,
Dan
http://danielmcghan.us
http://sourceforge.net/projects/tapigen -
how to use string field and its purpose...
STRING: Character string with variable length This data type can be used only in types (data elements, structures, table types) and domains. In the dictionary a length can be specified for this type (at least 256 characters). It can be used in database tables only with restrictions. For a description of them, refer to the documentation of the ABAP statement 'STRING'. In ABAP, this type is implemented as a reference to a storage area of variable size. The system proposes 132 characters as default for the output length. You cannot attach search helps to components of this type.
SSTRING: Short character string with variable length. In the Dictionary the number of characters can be specified for this type (from 1 to 1333). This data type can be used only in types (data elements, structures, table types) and domains. It can be used in database tables. To do so, refer to the documentation of the ABAP statement 'STRING'. In ABAP, this type is implemented as a reference to a storage area of variable size. String fields of this type can be used in indexes and in the WHERE condition of a SELECT statement. You cannot use them in table keys -
String Field rendering as Number Field in CR Basic for VS2008
I recently migrated from CR for VS2005 to CR Basic for VS2008 and am creating my first report using CR 2008. The SQL result set returns rows containing strings (nvarchar), integers and decimal (7,2) fields.
The report is getting all rows in the result set, but the string fields as defined in the SQL are 1) rendering in the report as numbers, and 2) showing as empty. The non-string fields render fine. I tried reformatting the report field to string, but only the Number tab appears in the formatting dialog. I also tried converting the SQL field result into an unbound string field, as well as tried the ToText function, but the results were the same. I suspect the field appears empty because of the formatting issue.
How can I get CR Basic for VS2008 to render a string (nvarchar) field as a string?Try placing the field inside a formula field or inside a text field. That should cause the field to be shown no matter what type of data it is. If the data is still not showing, then perhaps it is not being returned properly.
Things to check:
-Are you connecting directly to the tables - or are you connecting to a stored procedure? If you are connecting to a stored procedure and you are using Temp Tables, then make sure you add the line "SETNOCOUNT ON" to your stored proc.
-Run SQL profiler - see what query is being made, then try running that exact same query through the SQL admin console (Or some other utility that lets you run SQL queries)
Thanks
Shawn -
Updated to CR 2008 - now have new problem with truncated String fields.
Hi there
I'm hoping someone has a simple answer for this one... notice there's a lot of it on forums but I haven't found an answer.
Since updating to Crystal 2008 (Crystal 12), we have found that some reports are suddenly truncating string fields at 255 characters, despite the field value being much longer in the database.
Does anyone know what to do to allow these fields to print in completion?
Database connection is ODBC RDO.
regards
-KarenWhat is the database Oracle, SQL server etc.
Can you query the database directly with another query tool, eg SQL Server Management Studion or SQL developer/Toad for Oracle.
You can then run the Crystal query directly and see if its your ODBC connection that is truncating the datafield or Crystal.
I have memo fields on SQL server with up to 2000 characters and these display in Crystal 2008 without any problem. We use ODBC (RDO) too.
Ian
Maybe you are looking for
-
Streaming Iphoto slideshow from IPad II to Apple TV 2
Hello all, my englsh is not very well, but I'm try to explain my problem. I installed the app IPhoto on my IPad II. It works very well, In IPhoto I activate tv-synchronisation to get my IPad screen via apple tv 2 on my tv, but no screnn or picture
-
Using Mail 3.6 in Leopard 10.5.8 I know this is not a big deal, but it's annoying me and I'm sure there must be a simple fix. There are two ghost emails, one in the Inbox and one in Sent - both have names, dates and subjects but no content. No matter
-
Can I install Ubuntu in the SSD of Satellite U940-sp4103gl?
Please help me as soon as possible. These are my questions: Can I install ubuntu in the ssd of Toshiba u940-sp4103gl? How to do that? This is urgent, I'll appreciate any help. Thanks in advance.
-
I am trying to add the "startting pitchers" of a baseball team to my website. I see many sites are using this same info on their site but I can't figure out how they are doing it. The source seems to be the team's homepage. I have an RSS feed already
-
How to disable Interact option in the exported PowerView report?
Hi When I export a PowerView report (from SharePoint) as PowerPoint, it gives option to 'Interact'. However the customer does not want to have interaction in the PowerPoint. They just want to save the slides as images. How do we disable this 'Interac