How to write Display String formula for each cell in CrossTab? - crystal-reports

Formula scenario: Retrieved data has a status column which its values is (-1, 0, 1, 2, 3),
I'd like to use formula to display string based on these values. I use Display String, but it doesn't work.
How could I write a formula to work for each cell in crosstab?
Any suggestions?

Formulas are pretty easy to write. Just create a simple if/if else/else than statement:
if {TABLE.COLUMN} = 1 then 'One' else 'Unknown'
And use that within the cross tab.

use GridRowColumnValue("column name") to get the corresponding row or column value to want to evaluate for the cell in question

This is old, but I hope this help someone else.
Select CurrentFieldValue
Case 1:
"A"
Case 2:
"B"
etc.

Related

How to use tSQL to match and remove everything after either of 2 strings?

How can I use tSQL to find one of two strings, and if they exist, return everything before found string?
In an ETL process, how would we take the column from source, identify the strings ?uniquecode= OR /uniquecode= and therefore remove those, and everything else after them, in the SELECT statement for the sink column? i.e. matching desired outcome below.
On this SO question I was provided with a solution that finds ?uniquecode= successfully. I just need to find a way to modify it to also look for /uniquecode=
SELECT
CASE WHEN CHARINDEX('?uniquecode=', SourcePageURL) > 0
THEN SUBSTRING(SourcePageURL,
1,
CHARINDEX('?uniquecode=', SourcePageURL) - 1)
ELSE SourcePageURL END AS new_source
FROM sql_test;
You may modify your current query as follows:
SELECT
CASE WHEN SourcePageURL LIKE '%?uniquecode=%'
THEN SUBSTRING(SourcePageURL,
1,
CHARINDEX('?uniquecode=', SourcePageURL) - 1)
WHEN SourcePageURL LIKE '%/uniquecode%'
THEN SUBSTRING(SourcePageURL,
1,
CHARINDEX('uniquecode=', SourcePageURL) - 1)
ELSE SourcePageURL END AS new_source
FROM sql_test;
Demo

Display a value in one column based on a value in another column

I have two columns:
Of Procs
Of Procs with a procedure time
If column 2 is blank, and column 1 has a value, then I need column 2 to display a zero. What would a formula look like for that?
Use this formula
if ({Of Procs}="") then "0"
else {Of Procs}
I tested it and it works.
Hope it helps
if (isnull({TABLE.column 2}) or {TABLE.column 2}="")
and
(not(isnull({TABLE.column 1})) or {TABLE.column 1}<>"")
then
"0"
else
{TABLE.column 2}

How to hide a row in RDLC when particular field value matches with some string value?

For Ex:In RDLC, I have a Grid with the following columns
period,
Quantity,
description etc..
I will get Period values as dates and one value as "Avg", Now when My Period Value is "Avg", I want to hide that row from Grid in RDLC report.how can i do this?
I tried like below:
Row Visibility -> Show or Hide Based on Expression ->
(Fields!Period.Value = "Avg", True, False). But it is not working.
Please help me in this regard....
I would recommend to check actual values of Period field. Also, expression for Visibility in this case should start with equal sign and IIF (in case you didn't just copied it partially):
= IIF(Fields!Period.Value = "Avg", True, False)

Centura Gupta Team Developer Automation Possibility

Is there a automation tool which can automate the software build on Team Developer (v6.0).
I have tried with multiple automation tools to spy the table object in the application, it identifies it as Gupta ChildTable. But I am not able to retrieve the values from the row.
For example:
1. I have 10 rows in the table(grid) with 12 columns. I need to find the value "AAAAA" contained in first column and select that particular row via Automation.
2. I have 10 rows in the table(grid) with 12 columns. I need to find the value "AAAAA" contained in first column and click on particular cell in that row to input the data via Automation.
Thanks in advance.
Use VisTblFindString . This function ( and many others ) are included into your TD code if include 'VT.apl' in your include libraries .
VisTblFindString will return the Row - so then you simply set context to that row using SalTblSetContext( hWndForm, nRow ) , and then you can refer to the contents of each cell by name to return the value.
Syntax
nRow = VisTblFindString(hWndTable, nStartRow, hWndColumn, sString)
Handle: hWndTable
Number: nStartRow
Number: hWndColumn
String: sString
Description
Locates a string value within a column.
The string must match exactly, but case is ignored. Searching ends when the last row in the table is checked. A SAM_FetchRow message is sent for all rows that have not yet been fetched into the cache.
You can use the pattern matching characters understood by the function SalStrScan. The percent character (%) matches any set of characters. The underscore character ( _ ) matches any single character.
Parameters
hWndTable Table window handle.
nStartRow Row number at which to start the search.
hWndColumn Handle of column to search. Use hWndNULL to search all string columns.
sString String for which to search.
Return Value
Number: The row number if sString is found, or -1 if not found.
Example:
Set nRow = VisTblFindString (twOrders, 0, colDesc, 'AAAAAA')
Call SalTblSetContext( twOrders , nRow )
( Now you can get the value of any cell in nRow by referring to the Column Name )
e.g. Set sCellValue = twOrders.colDesc or Set sCellValue = twOrders.colId etc.
Rows ( or anything what-so-ever in a TableWindow - even the cell borders , backgrounds , lines, row headers etc ) can be treat as an 'Item' or 'Object' by TeamDeveloper . Recommend you use MTbl - it is an invaluable set of add-on functions that make dealing with Tables a breeze. I know of no sites using TableWindows that don't use MTbl. In terms of rows , you can define any row as an Item or Object and manipulate it accordingly. See M!Tbl ( a TableWindows extention ) and specifically fcMTblItem.DefineAsRow( hWndTbl, nRow ).
BTW , you can also use MTbl to completely change the look and feel of your TableWindows , to give them a real modern look.
Very rough napkin code, don't have TD on this computer. Not that you can copy&paste this easily anyway due to the code structure, only line by line.
tbl1 is the name of the table, col1 is the name of the column, substitute to fit your program.
Set nRow = TBL_MinRow
While SalTblFindNextRow( tbl1, nRow, 0, 0 )
Call SalTblSetContext( tbl1, nRow )
If tbl1.col1 = "AAAAA"
Call SalTblSetFocusCell( tbl1, nRow, tbl1.col1, 0, -1 )
Break
This should run through each row, check whether col1 has the chosen value, and then activates edit mode for that cell - provided the column is editable.

Order By alphanumeric values like numeric

there is a table's fields on MSSQL Serrver 2005 as VARCHAR. It contains alphanumeric values like "A,B,C,D ... 1,2,3,...,10,11,12" etc.
When i use below codes;
....
ORDER BY TableFiledName
Ordering result is as follow 11,12,1,2,3 etc.
When i use codes as below,
....
ORDER BY
CASE WHEN ISNUMERIC(TableFiledName) = 0 THEN CAST(TableFiledNameAS INT) ELSE TableFiledName END
I get error message as below;
Msg 8114, Level 16, State 5, Line 1 Error converting data type varchar
to float.
How can get like this ordering result: 1,2,3,4,5,6,7,8,9,10,11,12 etc..
Thanks in advance.
ISNUMERIC returns 1 when the field is numeric.
So your first problem is that it should be ...
CASE WHEN ISNUMERIC(TableFiledName) = 1 THEN
But this alone won't work.
You need to prefix the values with zeroes and take the rightmost
order by
case when ISNUMERIC(FieldName) =1
then right('000000000'+FieldName, 5)
else FieldName
end
Using 5 allows for numbers up to 99999 - if your numbers are higher, increase that number.
This will put the numbers before the letters. If you want the letters before the numbers, then you can add an isnumeric to the sort order - ie:
order by
isnumeric(FieldName),
case...
This won't cope with decimals, but you haven't mentioned them