Display text value instead of number in crystal report - asp.net

I have a crystal report in which my datas are displayed. In my database table the branches are to be represented in numbers like 1,2,3 etc. So after displaying in crystal report the place of branch name shows as 1. So instead of number I need to show it as office.
example: If the branch name is '1' then in crystal report it will display as 'office', how can I achieve this?

Try this...
StringYourVar text := Totext({YourNumberField} , 6 , "YourText");
or this.

Maybe This situation (Display keywords instead of integers) can help you.
If {YourNumberField} = 1 Then "Office"
Esle If {YourNumberField} = 2 Then "YourText" .
make sure use crystal syntax in editor

Related

Scraping an item that varies in position from a XML subpage

so far I didn't succeed in scraping the table "Die Verlustursache" from this page
http://www.ubootarchiv.de/ubootwiki/index.php/U_205
using libraries (XML) (rvest) (readr)
I can address all tables on the site with individual code lines like
table <-readHTMLTable("http://www.ubootarchiv.de/ubootwiki/index.php/U_203") %>% .[1]
but the numeric numbers vary on all the other sites.
check for example: http://www.ubootarchiv.de/ubootwiki/index.php/U_27
I just realized that the table I need is always the fourth last one (meaning: the last table minus 4).
In another scraping project, I once used this line to only scrape the last item of a list page:
html_nodes(xpath="/html/body/div/div[3]/div[2]/div[1]/div[2]/div/table/tbody/tr[last()]"
However, I was not able to find a solution for something like "last - 4"
Please advise & Thx in advance
You could use this if it is always the fourth last table:
table <-readHTMLTable("http://www.ubootarchiv.de/ubootwiki/index.php/U_203")
table[length(table) - 4]

Edit a data item in Cognos to display as two digits

Disclaimer: I am a Cognos newbie.
I want to format a data item in Cognos (Report Studio 10.2) to always display as 2 digits. For example, if the value of the data item in 2, I want it to be displayed as 02. How can I achieve this?
I have tried
Format$([my_data_item], "00")
Format([my_data_item], '00') - w/o the dollar sign
None worked.
Any help will be highly appreciated. Thanks!
Marcus ...thanks for pointing me in the right direction.
I was able to use the round function in the query with a CASE statement and it served my purpose with very little modification to the original report. Note to any new Cognos developer would be leave formatting to the report page and not the query.
case when [TRANSFORMATION VIEW].[SOME_FACT].[DOLLAR_VAL]<>-99999 then
case when [TRANSFORMATION VIEW].[SOME_FACT].[DOLLAR_VAL] >= 1000000 then
round( [TRANSFORMATION VIEW].[SOME_FACT].[DOLLAR_VAL] /1000000, 2)
else
round([TRANSFORMATION VIEW].[SOME_FACT].[DOLLAR_VAL],0)
end
end
Then on the report itself, I formatted the data item as Numeric and didn't change any of the default settings. That did the magic. The reason why I have round([TRANSFORMATION VIEW].[SOME_FACT].[DOLLAR_VAL],0) is because I don't want to display cents in the dollar amount.

inserting line breaks after every record in the textpad

I have a textpad file that has rows of text. For e.g.
Cat: Meaning - animal. The cat ran up the house
Rat: Meaning- rodent. The rat lives in the borough and feeds on leftovers
Word 3: Description
Word 4: Description
I have many such record in my file. I want to insert a line break at the end of every record for proper presentation. Doing it manually is tedious. Please help if you know an automated process to insert line break.
You can quickly do this by using a feature called "Regular Expressions" to find and add empty lines.
Open up the Find/Replace (Search menu > Replace)
In the "Find what" field, type the following: (^.+$)\n(^.+$)
In the "Replace with" field, type the following: \1\n\n\2
Tick the "Regular expression" checkbox
Click the Replace All button at least twice, but perhaps 3 times, until you get the message Cannot find the Regular Expression
Untick the "Regular expression" checkbox
Close the Replace dialog
Confirm the file is formatted as you are expecting
Save the file.
You can write a simple C# prgram that uses a loop that adds this code after every line :
But first add the namespace using System.Enviorment
Enviorment.NewLine;
If you have any more trouble i'll help with some code to get started
Open up the Find/Replace (Search menu > Replace)
In the "Find what" field, type the following so that the replace occurs at the end of each line: $
In the "Replace with" field, type the following. Note each 'n' represents a <return>. In this instance, I added a return at the end of a SQL statement, the word 'GO' on the next line and another <return>: \n\GO\n
Started with text file containing:
select * from <tablename>
select * from <tablename>
Ended with text file containing:
select * from <tablename
GO
select * from <tablename>
GO
Hope that helps.
from your text it is difficult to understand what you are intending to do. I'll give you some questions. The answers will help others to help you.
Do you really mean textpad as the product from company helios in UK or do you use this word as a general word for a class of tools (like notepad - but there is a general definition AND the tool as part of Windows).
Your file hase line breaks yet. You don't see them, but in the file itself they are present (in Unix systems line feed (hex code 0A) or in the windows world carriage return followed by line feed (hex code 0D 0A)).
Or would you like to publish your text in HTML? So you have to put the necessary tags around each line like paragraph, line break, list item etc.?

JasperReports: Convert Amount into Words

I am using iReport 4.7.
I want print amount in words.
For Example:
Assume Text field contains 1000 and i want print like "One Thousand".
Is anyone tell the steps to solve it?
Process your datasource before passing it to the report.
Using ibm's ICU4J you can convert amount into words by doing something like
double num = 2718;
RuleBasedNumberFormat formatter = new RuleBasedNumberFormat(Locale.ENGLISH, RuleBasedNumberFormat.SPELLOUT);
String result = formatter.format(num);
System.out.println(result);
Will print
two thousand seven hundred eighteen
If you are using Oracle database then try this:
SELECT TO_CHAR(TO_DATE($P{ParamName}, 'J'), 'Jsp')
FROM dual
This spells out whatever number you pass through $P{ParamName}. You can use this select clause in your main query's SELECT clause and use it.

Finding First Row in a RDLC Table

I have a table in a RDLC report which is utilized as a subreport, and the first column of this table is a static string. Does anyone know how I can determine if a row is the first in the table. I tried using "=First("My String")" but it didn't work.
Looking at the link supplied by ThatBloke in his answer, I found the RowNumber command.
Which means that this worked:
=IIf(RowNumber(Nothing)=1,"myString", "")
Aggregate functions work with "Scope', referring to the paragraph scope in this MSDN article, might help...
http://msdn.microsoft.com/fr-fr/library/ms252112(VS.80).aspx"
From what I understand you may have to define a scope or try =First("MyString", Nothing).
=IIF((RowNumber(Nothing) Mod <>)=0)
<> Indicate No of Rows Which you want To Display

Resources