Concordion print a variable string in green - concordion

In my java class I've defined an array of Strings and I can get any of them providing its index:
<span c:execute="#errStr=#page.getDictionaryString(2)"/>
so #errStr contains my String
in the test I receive the String to verify, in another var (#str)
<span c:execute="#str = #e.get()"/>
Now, I can have a green "true" if they are the same:
<span c:assertTrue="#str.equals(#errStr)">true</span>
Anyhow "true" adds less value when reading the output, I'd like to read there (in green) the value of #str (or #errStr that is the same).
Is it possible ?
If that is not possible is it possible to have at least the value of #str in normal color so that I'll then add a green "true" near it?

This use case is not supported out of the box, since Concordion encourages you to define the expected values in the specification, rather than deriving values dynamically. If possible, you should look to move the expected value into the specification.
If this is not possible, you can write a custom command through the use of Concordion extensions that does exactly what you want.
Or the following will give you an approximation:
<span c:assertTrue="#str.equals(#errStr)"><span c:echo="#str"/></span>
The echo command outputs the value of an expression to the specification. This will print the value of #str, and colour the output green. On failure the value of #str will be red and struckthrough, with =false printed next to it (this is where a custom command would improve the output).

Related

Pine Script - Dynamic Variables? (not necessarily correct terminology)

//#version=5
tspy = 60
blue = color.new(color.blue,tspy)
now when this following code executes many lines below/later:
tspy := 0
plot(rsi, title='bullish', color=blue)
As would be expected this does not change the transparency of variable blue by itself, obviously I can put blue := color.new(color.blue,0), but that is not ideal.
Is there a type of variable that is dynamic and will update itself whenever a variable contained within it changes, rather than having to manually re-execute the variables expression?
I have also tried setting the colours into a "function" call, but this seems to get complicated and causes more problems and code than just reentering/duplicating the original code. This may seem trivial, but it has a much wider importance and use case in more complex coding than this particular example.
Why not use a function?
//#version=5
indicator("My Script")
get_color(transp) => color.new(color.blue, transp)
plot(series=1, color=get_color(100))
plot(series=2, color=get_color(80))
plot(series=3, color=get_color(60))
plot(series=4, color=get_color(40))
plot(series=5, color=get_color(20))

SSRS Font Color Using Wildcard parameter

Hi I have a report that i used a wild card search parameter so that i can pull record that contains a certain text.
For example: I need to search for subscription for Mary Johnson so on the keyword search box i just type "John". This set-up is working fine, but now I need to color that search keyword when found for each row. so i need assistance on expression code that mimics SQL syntax of LIKE in SSRS expression. I started to change the font color with =iif(Instr(Fields!ReportRecipients.Value)=Parameters!Keyword.Value,"Maroon","Black"), but it didnt work.
Please advise.
Sample
TOJo.eger#m.com; ruth.tuker#m.com;sandrae.espe#m.com; dan.gay#m.comIncludeReportTrueRenderFormatPDFSubjectDaily Report for IBC Medicare? was executed at #ExecutionTimeIncludeLinkFalsePriorityHIGH"
You can use some .net string functions directly in SSRS expressions. In your case you can use the Contains() function like this.
=IIF(
Fields!ReportRecipients.Value.Contains(Parameters!Keyword.Value),
"Maroon",
"Black"
)
If you are dealing with HTML and only want the search term to be highlighted then you can simply use this as the Value expression. You must leave the text box color properties as default.
=REPLACE(
Fields!ReportRecipients.Value,
Parameters!Keyword.Value,
"<span style=""color:red;"">" & Parameters!Keyword.Value & "</span>"
)
Finally, right-click the placeholder, choose properties and select Mark-up type as HTML
In this example, I used a country list and searched for the word "land", here's the results. The first column just uses the first method I described. The second column adds HTML tags.

Indenting entire field value in visual studios

I'm trying to create a report that returns it's value indented if it meets a certain criteria in an iif expression. Is there anyway to do this?
I'm not sure if you mean to have the data itself indented or if you want the row to indent for a certain value, but I have a solution for the former issue. There is a set of properties associated with textboxes that deal with indenting text. There is HangingIndent, LeftIndent, and RightIndent. If your data is aligned to the left, you can use either HangingIndent or LeftIndent.
You'll need to put the following expression in whichever indent you require based on the alignment of your data.
=IIF([your Condition here], "10pt", "0pt")
This will indent the data by 10pt if true and leave the data unindented if false. I tested it with a simple dataset that pulled an ID from 1-9 and set the HangingIndent property to indent if the ID was equal to 5.
=IIF(Fields!id.Value = "5", "10pt", "0pt")
Which yielded these results:

Decriptive Programming Multiple properties

I am using to UFT and having a problem in describing multiple properties for an object.
b_username = "html id:=txtUsername","type:=text"
Trying this has not helped me. Even tried the ";" delimiter but that too is not working.
I think you have misunderstood how to reference an object using Descriptive Programming.
You still use the UFT syntax of Browser().Page().WebEdit() (for example) and because you are trying to set an object reference you need the Set keyword. Try something like:
Set b_username = Browser("micclass:=Browser").Page("micclass:=Page").WebEdit("html id:=txtUsername","type:=text")
This will allow you to use b_username to reference the text box with the html id of txtUsername:
b_username.Set myUsernameValue
For a pretty good basic introduction to descriptive programming, check out LearnQTP.com
What you are more closing attempting to do is to build a Description Object.
You need something like the following:
'Creating a description object
Set btncalc = Description.Create()
'Add descriptions and properties
btncalc("type").value = "Button"
btncalc("name").value = "calculate"
btncalc("html tag").value = "INPUT"
' Use the same to script it
Browser("Math Calc").Page("Num Calculator").WebButton(btncalc).Click
This SO article has a good explanation of a little more advanced technique.
How to create description object model at runtime in uft/qtp?
Please let me know if this clears up some confusion.
I would suggest you to use the below library for descriptive programming. It saves you from creating tons of descriptive objects. Check the usage in the link below.
http://www.testautomationguru.com/qtpuft-advanced-descriptive-programming/
To enter some value in the all the textboxes (no need to iterate)
Browser("creationTime:=0").Page("micclass:=Page").getChildObjects("micclass:=WebEdit").SetValue "1"
To enter some value in a textbox whose name starts with ‘guru’
Browser("creationTime:=0").Page("micclass:=Page").getChildObjects("micclass:=WebEdit,name:=guru.*").SetValue "1"
The above example can also be written as
Browser("creationTime:=0").Page("micclass:=Page").getChildObjects("micclass:=WebEdit").WithRegExProperty("name:=guru.*").SetValue "1"
To get the fifth visible child object which has the name as guru.
Browser("creationTime:=0").Page("micclass:=Page").getChildObjects("micclass:=WebEdit").WithRegExProperty("name:=guru.*").Index(4).Set "1"
To enter the values only in the visible text boxes
Browser("creationTime:=0").Page("micclass:=Page").getChildObjects("micclass:=WebEdit").WithRegExProperty("name:=guru.*").VisibleChildObjects.SetValue "1"
To select all visible check boxes
Browser("creationTime:=0").Page("micclass:=Page").getChildObjects("micclass:=WebCheckBox").VisibleChildObjects.SetValue "ON"
To get items count
Browser("creationTime:=0").Page("micclass:=Page").getChildObjects("micclass:=WebCheckBox,type:=checkbox,name:=jqg_list.*").VisibleChildObjects.getCount()
To match certain property values
Browser("creationTime:=0").Page("micclass:=Page").getChildObjects("micclass:=WebEdit").WithRegExProperty("name:=guru.*").VisibleChildobjects().Set "1"
To give some delay between 2 ‘Set’ – [if required for something]
Browser(“creationTime:=0”).Page(“micclass:=Page”).getChildObjects(“micclass:=WebEdit”).WithRegExProperty(“name:=guru.*”).VisibleChildobjects().DelayEachSetBy(1).Set “1”

RDL report - change of header text in CSV export by parameter

I am working on rdl reports and as I had to add multilingual support, I need to be able to change the column headers' text by the selected language parameter.
I added this very basic custom expression to the header:
=IIF(Parameters!Language.Value="EN", "Date", "DateInDifferentLanguage")
but when I export the report to CSV this is completely ignored, moreover, the column header will be the assigned value's name.
I tried to search for solution for almost 2 days, but the only thing I found that I should use the DataElementName property. Well, for static values it works, but as the text is parameter-dependent I have to use custom expressions and this property does not allow me to use anything like that.
Hopefully, there will be no difference in the solution for grouped columns.
So, my question is: is it possible to add parameter-dependent custom expressions to grouped/not grouped columns?
EDIT: I just realized that you can't set the DataElementName property by expression. I'll leave this up in the off-chance that it may help in some way.
If you're wanting different expressions based on a parameter, try this:
Make sure you can see your Report Data. View -> Report Data(at the bottom)
Start by creating the parameter. Right click Parameters folder in the Report Data window -> Add Parameter... Let's call it 'Language'.
In the available values tab, click Specify Values. Add values for your languages, so the label will be what you want the viewer to see, make the value the same.
Label: English
Value: english
In the Expression you're trying to modify, simply put the available expressions you want in an SWITCH() block.
SWITCH(Parameters!Language.Value = 'english', [do english things],
Parameters!Language.Value = 'spanish', [do spanish things],
Parameters!Language.Value = 'chinese', [do chinese things],
True, [do english things])