Expression IIF report rdlc - expression

How can I make a expression to compare multiple textbox and get a value?
I have this Expression: =IIF(fields!productformat.Value="Fresh - Skin OFF Loin", "OFF", "") but I need first to check other textboxes and columns if matches then gives the result.
Imagine:
I have 2 column "Specie" and "Skin" and 2 textboxes (txtSpecie and txtSkin), so first it most check if the txtSpecie is the same with the "Specie" column if yes then check what's the value of the "Skin" if the Skin value = "Skin Off" convert to "Off" if "Skin On" convert to "On"

Related

How do I identify whether a column entry starts with a letter or a number using m code in power query?

I have a column that contains either letters or numbers. I want to add a column identifying whether each cell contains a letter or a number. The problem is that there are thousands of records in this particular database.
I tried the following syntax:
= Table.AddColumn(Source, "Column2", each if [Column1] is number then "Number" else "Letters")
My problem is that when I enter this, it returns everything as "Letter" because it looks at the column type instead of the actual value in the cell. This remains the case even when I change the column type from Text to General. Either way, it still produces "Letter" as it automatically assigns text as the data type since the column contains both text and numbers.
Use this expression:
= Table.AddColumn(Source, "Column2", each if List.Contains({"0".."9"}, Text.Start([Column1], 1)) then "Numbers" else "Letters")
Note: It would have been smart to add sample data to your question so I wouldn't have to guess what your data actually looks like!
Add column, custom column with
= try if Value.Is(Number.From([Column1]), type number) then "number" else "not" otherwise "not"
Peter's method works if the choice is AAA/111 but this one tests for A11 and 1BC as well

Filtering Value or Blank in Google Sheets

I would like to filter a specific value as well as blank values.
Example: Filter if the value is "VALUE" or ""
I tried this:
=filter({Summation!E2:K},match(Summation!D2:D,{$B$1,""},false))
And also tried this:
=filter({Summation!E2:K},or(match(Summation!D2:D,{$B$1},false),isblank(Summation!D2:D)))
But non of these work. How do I match for blank values. I want all blank values as well as those with the value B1.
You could use something like =QUERY(B1:K,"Select * where B='' and B='VALUE'",0)
That selects all data in the range B1:K where column B is blank (B='') AND where B is equal to VALUE (B='VALUE').
Replace B with whatever column contains the value you're trying to find.

BIRT visibility hide if value = string with spaces

I am trying to hide a row in BIRT when a specific value equals a string. It works when the value equals something like 3 or (this_is_the_value) but it does not work when the value equals something like (this is the value) -> a value in the database with multiple words with spaces between them. How do I build the expression that hides the row when a value equals (this is the value) instead of (this_is_the_value)
Any help would be appreciated..
Michel
You have to enclose your value with quotes "this is the value" and use the double equals sign == to compare it to your row.
By the way, you can hide/show a visual text parameter in an expression like this:
!params[NAME_ID].value

grid filter in foxpro

I have a grid on a form that displays some columns from a dbf table and a textbox.
I want to search the value displayed in the textbox over all columns from a dbf table. Some fields are numeric and other are character
If I want to find a number, should search all record that contain that number in all columns, no matter the column type.
If I want to search a substring should give me all record that contain that substring.
SET FILTER TO ALLTRIM(ThisForm.Text1.Value) $Content or ALLTRIM(val(ThisForm.Text1.Value)) $registrationNumber or ALLTRIM(ThisForm.Text1.Value) $holderNo
Your approach with the "$" wildcard "contains" approach appears to be ok. However, your attempt via allt( val( )) would fail as you cant trim a numeric value, it would have to be pre-converted to a string.
Now, that said, you could shorten your query by just doing a $ against a concatenation of ALL columns something like (assuming your registration number is a numeric field)...
set filter to ALLTRIM(ThisForm.Text1.Value) ;
$ ( Content +"," +str(registrationNumber) +," + holderNo )
if you have dates or date/time fields you could do DTOC( dateField ) or TTOC( dateTimeField). So, by building a single string of all values, you dont have to explicitly repeat the OR condition repeatedly.
You could do something like:
select curGrid
scan
lcRow = transform(field1) + transform(field2) ... + transform(lastfield)
if lcSearchValue $ lcRow
DoWhatever()
endif
endscan
This leverages the fact that transform() will give a string representation of any data type.

xquery- how to select value from a specific element even when that element has null values/multiple return-separated values

Please consider the following XML--
<table class="rel_patent"><tbody>
<tr><td>Name</td><td>Description</td></tr>
<tr><td>A</td><td>Type-A</td></tr>
<tr><td>B</td><td>Type-B</td></tr>
<tr><td>C</td><td>Type-C</td></tr>
<tr><td>AC</td><td>Type-C
Type-A</td></tr>
<tr><td>D</td><td></td></tr>
</tbody></table>
Now I want to select and display all values of "Name" with corresp. values of "Description" element...even when Description element has null values viz element with name=D, and also, when description element has values separated by enter then I want those values (of Description) in separate rows- viz Type-C and Type-A for element with name=AC
This is the type of query I have written--
let $rows_data:= $doc//table[#class="rel_patent"]/tbody/tr[1]/following-sibling::tr
for $data_single_row in $rows_data
return
let $cited_name:= $data_single_row/td[1]
let $original_types_w_return:= $data_single_row/td[4]
let $original_types_list:= tokenize($original_types_w_return, '(\r?\n|\r)$')
for $cited_type_each at $pos2 in $original_types_list
return concat( $cited_name, '^', $original_type_each, '^', $pos2)
However, I am getting the following type of response--
A^Type-A^1
B^Type-B^1
C^Type-C^1
AC^Type-C
Type-A^1
Now, I need to get the following correct in the above code+response---
(1) The data for "AC" should be 2 separate rows with "Type-C" and "Type-A" being in each of the 2 rows along with corresp. value for last field in each row as 1 and 2 (because these are 2 values)
(2) The data for "D" is not being shown at all.
How do I correct the above code to conform with these 2 requirements?
This works:
for $data_single_row in $rows_data
return
let $cited_name:= $data_single_row/td[1]
let $original_types_w_return:= $data_single_row/td[2]
let $original_types_list:= tokenize(concat($original_types_w_return, " "), '(\r?\n|\r)')
for $cited_type_each at $pos2 in $original_types_list
return concat( $cited_name, '^', normalize-space($cited_type_each), '^', $pos2)
(The first change was to replace $original_type_each with $cited_type_each and [4] with [2] which may ).
The first problem can be solved by removing the $ at the end of the tokenize parameter, since in the default mode $ only match the end of the string.
The second one is solved by adding an space $original_types_w_return, so it is not empty and tokenize returns something, and then removing it again with normalize-space (in XQuery 3.0 it could probably be solved by using 'allowing empty' in the for expression)

Resources