In rdlc split(winform) how to get last index value of an array. For example.
=Split(First(Fields!ID.Value),",")(2).
In this, How to take the value 2 as the last index value of the splitted array?
i got the solution, Actually , ,my problem was to get 'ghj' from 'xxxxx F/O ghj'. i accomplished , it by first replacing 'F/O' with comma and then spliting based on comma
SPLIT(Replace(Fields!Name.Value,"F/O",","),",")(1)
Related
I'm using the following code to get a user's recovery_token and store it in a variable:
Connect To Database psycopg2 ${DB_NAME}
... ${DB_USER_NAME}
... ${DB_USER_PASSWORD}
... ${DB_HOST}
... ${DB_PORT}
${RECOVERY_TOKEN}= Query select recovery_token FROM public."system_user" where document_number like '57136570514'
Looking at the log, the recovery_token is being saved as follows:
${RECOVERY_TOKEN} = [('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImU3ZGM4MmNjLTliMGQtNDc3OC1hMzM0LWEyNjM4MDU1Mzk1MSIsImlhdCI6MTYyMzE5NjM4NSwiZXhwIjoxNjIzMTk2NDQ1fQ.mdsrQlgaWUol02tZO8dXlL3KEwY6kqwj5T7gfRDYVfU',)]
But I need what is saved in the variable ${RECOVERY_TOKEN} to be just the token, without the special characters [('',)]
${RECOVERY_TOKEN} = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImU3ZGM4MmNjLTliMGQtNDc3OC1hMzM0LWEyNjM4MDU1Mzk1MSIsImlhdCI6MTYyMzE5NjM4NSwiZXhwIjoxNjIzMTk2NDQ1fQ.mdsrQlgaWUol02tZO8dXlL3KEwY6kqwj5T7gfRDYVfU
Is there any way I can remove the special characters?
Thanks in advance!!
The returned value is a list of tuples, a two-dimensional matrix (e.g. a table); if you have queried for 3 columns for example, the inner tuple would have 3 members. And if there were 5 records that match it, the list would have 5 tuples in it.
Thus to get the value you are after, get it from the matrix by its indexes (which are 0-based, e.g. the first element is with index "0"):
${RECOVERY_TOKEN}= Set Variable ${RECOVERY_TOKEN[0][0]}
I want to count number of occurrences of a word in a string for example ,
[{"lastUpdatedDateTime":{"timestamp":1.54867752522E12},"messageStatus":"DELIVERED","phoneNumber":"+916000060000"},{"lastUpdatedDateTime":{"timestamp":1548677525220},"messageStatus":"DELIVERED","phoneNumber":"+916000060000"}]
in above string i want to count no of occurrences of a word 'DELIVERED' here it is 2.
i want to get result 2. pls help me on this. i should have to use only sql query to achieve this.
thanks in advance.
If your table's name is tablea and the column's name is col:
SELECT
(LENGTH(col) - LENGTH(REPLACE(col, '"DELIVERED"', '')))
/
LENGTH('"DELIVERED"') as counter
from tablea
remove every occurrence of "DELIVERED" and subtract the length of the string from the original string and finally divide the result with the length of "DELIVERED"
Assuming your data is in a table something like:
CREATE TABLE example(json TEXT);
INSERT INTO example VALUES('[{"lastUpdatedDateTime":{"timestamp":1.54867752522E12},"messageStatus":"DELIVERED","phoneNumber":"+916000060000"},{"lastUpdatedDateTime":{"timestamp":1548677525220},"messageStatus":"DELIVERED","phoneNumber":"+916000060000"}]');
and your instance of sqlite has the JSON1 extension enabled:
SELECT count(*) AS "Number Delivered"
FROM example AS e
JOIN json_each(e.json) AS j
WHERE json_extract(j.value, '$.messageStatus') = 'DELIVERED';
gives you:
Number Delivered
----------------
2
This will return the total number of matching entries from all rows in the table as a single value. If you want one result per row instead, it's an easy change but the exact details depend on your table definition. Adding GROUP BY e.rowid to the end of the query will work in most cases, though.
In the long run it's probably a better idea to store each object in the array as a single row in a table, broken up into the appropriate columns.
I have a column in a teradata table with string values like "page1-->page2-->page1-->page3-->page1--page2-->..."
I want to search for a specific page and get the number of occurrence of the page in the string. I couldn't find any function that gives this result.
There's no builtin function, but there's a common solution:
Remove all occurences of the substring from the string and compare the length before/after:
(Char_Length(string) - Char_Length(OReplace(string, searchstr))) / Char_Length(searchstr)
Edit:
For a wildcard search you can utilize REGEXP_REPLACE:
Char_Length(RegExp_Replace(RegExp_Replace(s, 'page1(.+?)page3', '#',1,0), '[^#]','',1,0))
For `#' use a character which is known not to be in your input string.
Calling all RDLC expert out there.
When displaying the values of the parameter(which the values is in array) to a tablix or table, it only displays the first value data of the array.
Which looks like this.
I want to display the 626 datas of the array to be displayed individually in rows.
There are about 626 datas inside the array named Testparameter, but it seems to that it only displays the first value of the array.
Maybe I must be missing something in the expression in reproducing the values.
This is the expression that I am using
=Parameters!Testparameter.Value
I have also tried JOIN expression but it displays all the 626 datas inside the column.
=Join(Parameters!Testparameter.Value,", ")
Whic resulted to this.
Any ideas what I am doing wrong? or is this possible?
Thank you in advance.
It seems that the dates returned from the parameter have an enter (\n) or some spaces, what you can try is to replace all the string \n or spaces to empty string and check.
I am dynamically adding columns to a crystal reports data source as explained here Dynamic_Reports.
Here i need remove columns whenever i am not filling values to depends upon columns. These columns are i need to remove from a crystal reports at run time.
Why i need like this means,I have 20 columns and going fill 1st ,2nd ,19th and 20th columns Only.Rest of them having blank space.blank space[columns] are need to remove.
Include a formula checking null value for the particular column and if null dont insert. These you can check after filling in the database.
EDIT:
example:
If !IsNull({Product.Color}) Or InStr({Product.Color}, " ") != 0 Then
totext({Table.Column})
You can drag the required column for which you suspect it will be blank in to the ( ) of IsNull or InStr