How to seperate prefix from a dynamic text before printing in BIRT - eclipse

The name which i want to print in the report as a dynamic text is in the encrypted format in the DB. I decrypt this name with the help of the following script in onCreate of this dynamic text field.
this.text=Packages.com.erp.util.EncryptUtil.decrypt(name);
Now the problem is, this name comes with the prefix Mr,Ms etc concatenated with the name in some reports which is affecting the name decryption, I want the name alone for decrypt. Separating the prefix and name in query is disturbing the binding and leads to some other errors. So what i want to do is check the name for any space or split so that i can identify after the 1st space whatever coming would be the name and before space would be prefix. Then i want to send that name alone to the decypt method and on returning decrypted name should concatenate with the prefix using some script and print in the dynamic text field. How to achieve this in the BIRT Report Designer Version: 3.7.1.v2

From DataSet Drag and drop the name attribute into the report somewhere and make it invisible. Go to the onRender of that name attribute which available from the script tab in BIRT and paste the following code to separate prefix from name and send the name alone to your method.
name = this.getValue();
var sArr = name.split(" ");
name="";
for(var i=1;i<sArr.length;i++){
if(sArr[i]!=null)
name = name+" "+sArr[i];
}
name = name.replace(/^[ ]+|[ ]+$/g,'')
name=sArr[0]+" "+Packages.com.yourpackagename.yourmethodname(name);
Now drag and drop the dynamic text from the palette to the position where you want see the name. Go to the onCreate of that dynamic text field which available from the script tab and paste the following code to print the result which returned from your method along with the prefix.
this.text=name;

Related

Reaching the referenced text from a Word interop field object

I am using Word interop to build a Word plugin. In this plugin I have a case where I want to examine all
Field objects in the document and when that field is a cross-reference to another place in the same document I need to be able to capture the text in the paragraph that the field is referring to.
I was able to get the name of the field object but there were no bookmarks defined in the Document although in Word I could click on the field to get to the other location.
Example field
Example field as code
referenced text I need to get
No Bookmark objects are defined
I tried to simulate the user clicking on the field by invoking DoClick() on it and then I accessed V_V_Scalar_Document_Generic.Application.Selection.Range.Text
but it gave nothing. I also tried the GoTo approach below but still didn't reach the referenced text.
System.Collections.Generic.List<string> L_V_List_String_Fields = new System.Collections.Generic.List<string>();
foreach (Field L_V_Scalar_Field_Item in V_V_Scalar_Document_Generic.Range.Fields)
{
try
{
if (L_V_Scalar_Field_Item.Type == WdFieldType.wdFieldRef)
// L_V_Scalar_Field_Item.Data --> gives COM exception
// L_V_Scalar_Field_Item.Code.ID --> blanks
// L_V_Scalar_Field_Item.DoClick() 'will not help because fields are not always hyperlinks
// L_V_Scalar_Field_Item.Result.Text --> gives the text of the field itself
// all variations I tried for the target parameter in the line below (last param) are not working
// V_V_Scalar_Document_Generic.[GoTo](Microsoft.Office.Interop.Word.WdGoToItem.wdGoToField, System.Type.Missing, System.Type.Missing, "_Ref28680085")
// Dim L_V_Scalar_String_Source as string = V_V_Scalar_Document_Generic.Application.Selection.Range.Text
L_V_List_String_Fields.Add($"CodeText:{L_V_Scalar_Field_Item.Code.Text} |FieldType:{L_V_Scalar_Field_Item.Type} |FieldKind:{L_V_Scalar_Field_Item.Kind} |SourceText:{"source text ??"}");
}
catch (Exception L_V_Scalar_Exception_Generic)
{
}
}
The bookmarks are not listed because Word has a convention that bookmarks with names starting with an underscore ("_") are "hidden". In the Insert->Links->Bookmark dialog box, you can see them if you check the "Hidden Bookmarks" box, but in the Find and Replace box, you have to enter the name manually.
Even when Bookmarks are hidden, you can reference them. So for example you should be able to do something like this (this is VBA syntax):
Dim TargetText As String
TargetText = ActiveDocument.Bookmarks("_Ref28680085").Range.Text
to get the text "covered" by the bookmark. In theory, you could use Goto, by using wdGotoBookmark instead of wdGotoField, except that I think it will only have a chance of working with the Selection object, not a Range object.
Depending on what type of cross-reference the user inserts, Word "covers" different parts of the referenced material. So you may need to construct the Range you really need, e.g. using the Bookmark's Range.Start to tell you which paragraph the reference is pointing at.

SSRS does not work when input parameter has a + sign

I'm creating a report which has as input parameters: id and name. These parameters are used in the where clause of the select from which I get the records to display in my list.
The problem is that if there is a + sign into the name the parameter (that I print on the page to display the filter) name appears with a space instead:
Input parameter = "record+story"
Parameter shown in report: "record story"
So the result of the select is empty, since the name doesn't match!
What am I missing?
EDIT: I open the report through a client application, based on VB6. There is a main page with a table and a list od ids, when I click on a row of the list it redirects me to an IE page performing the filtering and showing only the needed data.
The parameters are: id - Integer, and name - text.
When it opens the IE page I see that if the name contains a plus sign there appears instead a space, which of course is wrong, therefore the resulting report is empty.
I already tried to add the System.Web reference to VB6 in the client application, but it doesn't work.
Here a picture to clarify what I mean.
Thank you
C.
In the end I got the solution. I only need to encode my parameter so that the + sign is read as a + sign. This is achieved by using the hex value in the code behind:
example: namewithplussign ==> replace(namewithplussign , "+", "%2b")

Attribute name must contain word characters only

I'm creating a profile form using gii and after doing the gii part and when I open the page for creating the form and I click on the "Creating Profile" it shows up with this error:
Invalid Parameter – yii\base\InvalidParamException
Attribute name must contain word characters only.
and this is the photo of the associated table in the db.
phpmyadmin table view
if you needed anymore informations just let me know.
In your table You have
father-s_name
the - is not allowed in yii2 field naming convention
use
father_s_name or fathers_name
for example your column name is İmage_name capital letter(İ) you may take such error. You must change with lowercase letter(i), for example: image_name

Tableau Action URL: field name needed twice to construct a valid link

I've used worksheet URL actions in tableau before and they are Great! But I have a case where to construct a valid link- I need the field twice.
something like....
"http://wwwin-esstools-prd.cisco.com/pmt/emailfilters/EmailFilter.json/?&id=FIELD&queryObj={"conjunction":"and","expressions":[{"op":"equals","attr":"id","value":FIELD}],"preFilterQuery":"","name":"Advanced Filter"}"
where FIELD is the field name I would like to use to properly construct the url. I have tried using both the select and menu options-
both seem to be ignored by tableau.
FIELD needs to be surrounded by angle brackets. You can use the Insert menu on the URL action dialog panel to insert field names into your URL if you prefer, and thus avoid spelling errors. Or simply type the field name and brackets where you want them.

Crystal 2013 - Is field in field possible?

i am creating a template for an invoice-document. There are some text-blocks i want to include from external via DB-Field so that i can manipulate the text without changing the RPT-File. As some of the Text-Block also inlude VARS i was wondering if there is a chance to also include the VAR itself into the text-block, meaning we have a Field including a Field.
Is this possible? My first tests failed as the Name of the Var is interpreted as text and just printed but not changed into the VAR-Value.
--- Edit ---
Example:
Database-Field: {Table1.Value} -> 4.00
Database-Field: {Table1.Text} -> 'The value is {Table1.Value}'
If i now add {Table1.Text} into the report, it should show as "The value is 4.00"
Yes this is possible. Create a regular text box and set its text. Then drag a database field or a formula from the field explorer on the text box.