Subfield Function
Subfield Function
Is there a SubField function, or a way to create one in Stimulsoft.
I have a delimited list and I need to select the Nth value to display.
I've seen a function in other report engines in which you specify a string, a field number, and a delimter, and it returns the appropriate string.
For example:
SubField("AAA|BBB|CCC|DDD|EEE|FFF",3,"|") returns CCC
SubField("AAA;BBB;CCC;DDD;EEE;FFF",5,";") returns EEE
If there was no delimiter, it would return the whole string.
I have a delimited list and I need to select the Nth value to display.
I've seen a function in other report engines in which you specify a string, a field number, and a delimter, and it returns the appropriate string.
For example:
SubField("AAA|BBB|CCC|DDD|EEE|FFF",3,"|") returns CCC
SubField("AAA;BBB;CCC;DDD;EEE;FFF",5,";") returns EEE
If there was no delimiter, it would return the whole string.
Re: Subfield Function
Hello,
Unfortunately, but this function is not available on our product.
As a way, you can add it manually in designer on Code tab and then use it.
Thank you.
Unfortunately, but this function is not available on our product.
As a way, you can add it manually in designer on Code tab and then use it.
Thank you.
Re: Subfield Function
Can you provide the code required to create this function?
Re: Subfield Function
Hello,
You can add the following function:
and use the following expression:
Thank you.
You can add the following function:
Code: Select all
public string SubField(string s, char delimeter, int index)
{
return s.Split(new char[] { delimeter })[index - 1];
}
Code: Select all
{SubField(v2, '|', 3)}
Re: Subfield Function
Thank you for the response. The formula itself is working correctly.
I need to have the field inex increment with the page number. The formula is located on in a Child Data band, with a filter to only show certain values. When I type in a number as the index, it works fine. When I use PageNumber as the index, it does not use the filter, and it shows the wrong values.
https://dl.dropbox.com/u/99199395/SubField%20Issue.PNG
I created 2 Child Databands, the one at the top right shows when using pagenumber as the index. the lower values are showing correctly for an index of 1, which is how the formula is hard coded.
Data and report in the zip below.
https://dl.dropbox.com/u/99199395/Micro ... kOrder.zip
I need to have the field inex increment with the page number. The formula is located on in a Child Data band, with a filter to only show certain values. When I type in a number as the index, it works fine. When I use PageNumber as the index, it does not use the filter, and it shows the wrong values.
https://dl.dropbox.com/u/99199395/SubField%20Issue.PNG
I created 2 Child Databands, the one at the top right shows when using pagenumber as the index. the lower values are showing correctly for an index of 1, which is how the formula is hard coded.
Data and report in the zip below.
https://dl.dropbox.com/u/99199395/Micro ... kOrder.zip
Re: Subfield Function
Hello.
Sorry, we need more time to prepare an answer for you.
Thank you.
Sorry, we need more time to prepare an answer for you.
Thank you.
Re: Subfield Function
Hello,
For correct result you can use the additional variable instead the ""PageNumber". And increment this variable in BeforePrint event of DataBand1 component.
Thank you.
For correct result you can use the additional variable instead the ""PageNumber". And increment this variable in BeforePrint event of DataBand1 component.
Thank you.
- Attachments
-
- Label no Factory1.mrt
- (70.8 KiB) Downloaded 180 times
-
- Capture.PNG (52.71 KiB) Viewed 1845 times