How do I fetch the value of a checkbox in the installscript in Installshield?
Background :
I have a checkbox which has property "UALCSTATUS" and its value is "ON" .in the Dialogs section . When I fetch the value in installscript using the following command, it fetches 0 or nothing (whether checked or unchecked)
MsiGetProperty(hMSI, "UALCSTATUS", szStrValue, nVal);
Do I have to set a custom action when I check the checkbox so that I can set the value of "UALCSTATUS" property in order that it gets set to "ON" .
Properties tied to check boxes in Windows Installer UI are set to values that evaluate to true or false. While you can tweak the exact value used for true/checked in the CheckBox table, a simpler approach would be to call MsiEvaluateCondition with a condition string of the name of the property, and compare it with MSICONDITION_TRUE (1):
if MsiEvaluateCondition(hMSI, "UALCSTATUS") = MSICONDITION_TRUE then
: : :
endif;
Alternately for such a simple condition, you can just get the property as you described and compare it to an empty string. If it's empty, so is the check box. If it's set to anything else, the check box is checked.
As a side note, for a project using InstallScript-based UI, instead of checking properties, you'd be calling CtrlGetState to determine if the check box is checked. Typically this is then exposed through a byref parameter to the function that displays the dialog box.
Related
I need to select a check box as shown in below image. I tried giving "Set Checked" on Navigate stage but it didn't seem to work.
When i try to capture the Checkbox element using HTML Mode, it is getting captured as a HTML Element and not HTML Checkbox.
Can anyone help me here please.
In my projects, a lot of times it was possible to use action "Write", and write value "True" to this element.
If not, then it should be possible to change the element type directly in the Application Modeler. Please inspect first your element, and then change these two parameters:
Element type = "HTML Check Box"
Data Type = "Flag"
Afterwards, in "Navigation" stage, there should be an action "Set checked" available.
For reference, I was able to inspect the logo from w3schools.com and mark it as checkbox in BluePrism.
Just take your datatype as 'Text' and set it to click centre in navigation.
While running the step it will set it checked and proceed it further.
When you use the "Set Checked" action as part of a Navigate stage, you have to set the "Checked" parameter in the lower portion of the Stage Properties window to "True".
Identify the required check box in Active Accessibility SPY Mode. The element Type for this will be Check Box(AA), Change it to Active Accessibility from the drop down. And then use this element in Navigate stage and select "Global Mouse Click Center" in the Actions drop down, to Check this check box
I have a report page which displays a crosstab. This is filtered by 5 paramaters. These paramaters are submitted by the user through on page checkbox prompts.
The requirement is to return the data with all values in all paramaters selected on the first run. If I leave default selections blank this behaviour is achieved but all the checkboxes are unchecked which gives misleading feedback to the user.
As an alternative I've manually specified all the values in default selections. However, this has a performance impact.
Does anyone have any alternative suggestions?
I've been looking for a way to specifically link a reprompt button to a value list so only those paramaters are resubmitted (rather than the whole page) but haven't found anything yet.
Thanks in advance - even if the answer is 'no and this is a bad way to go about it'!
One option is to use JavaScript to check all of the checkboxes after the page is rendered with no filtering applied. To do this all filters have to be set to optional. The page is rendered with all data and unchecked checkboxes. The JavaScript fires and checks all checkboxes so that the state of the prompts matches the state of the data. This happens so fast the user likely won't know the boxes weren't checked initially. A reprompt button will, when clicked, enforce whatever choices the user makes after that.
Since version 10.2, Cognos has provided a fairly simple JavaScript API to allow for render-time manipulation of prompt controls. Hopefully, you are working with 10.2 or later otherwise the code provided will not work. Here is a bit of JavaScript code that will loop through all prompts and select all values within them:
var report = cognos.Report.getReport("_THIS_");
var prompts = report.prompt.getControls();
if (typeof firstrun == "undefined") {
var values;
for (var i=0;i<prompts.length;i++) {
values = prompts[i].getValues(true);
prompts[i].addValues(values);
}
var firstrun = false;
}
Notes:
All value prompts behave the same way regarding the 10.2+ JavaScript Prompt API. It doesn't matter whether you choose a drop-down, list, checkbox or radio button interface. The way we code for all of these variations is the same. The provided code would work just as well with a list as it would with checkboxes.
Make sure that you wrap your code in script tags and that the HTML Item object you place on your page to hold the code appears below all prompt controls. If it is placed elsewhere it will not be able to find the prompt controls as they will not have been rendered when the code executes.
The code assumes that the only prompts on the page are the checkboxes you want checked. If there are other prompts on the page then you will have to target individual prompts using the getControlByName() function provided in the API rather than looping through all prompts. More information on the Cognos JavaScript Prompt API can be found here.
The key bits of code here are the getValues() and addValues() Cognos JavaScript Prompt API functions. getValues(true) returns a JSON-formatted object representing all values, selected or not, from a value prompt. addValues(values) takes a JSON-formatted object representing the values to be selected and selects them. Thus, it's a matter of grabbing all values and then passing them in to be selected.
The reason for the if block is that we only want this code to run once at first page render. When the user first runs the report we want all checkboxes checked but after that we want the checkboxes to retain state. If we didn't use the if block the user's choices would be overwritten after a reprompt. For more information on this technique check out this tutorial on my blog: JavaScript: Running Code Only Once.
Addendum
If you don't want any filters to be applied when all boxes are checked in a section even after subsequent reprompts you can do so by tweaking your filter.
Assume that we are checking against a model based item [Item1]. We have a current filter of: [Item1] in ?parameter1?. We also have four checkboxes with values of 'Choice1','Choice2','Choice3', and 'Choice4'.
The following modified filter will only apply the checkboxes to the filter when all four aren't checked:
(
'Choice1' in ?parameter1?
AND
'Choice2' in ?parameter1?
AND
'Choice3' in ?parameter1?
AND
'Choice4' in ?parameter1?
)
OR
[Item1] in ?parameter1?
If all four checkboxes are checked then the first part of the OR is satisfied and all rows will be returned. It should be fast too because most languages, including iterations of SQL, will not test the second component of an OR if the first component is satisfied.
I am trying to check my check box in Geb.
I have tried following codes, but no luck
$('input', type:'checkbox', id: 'chkTermsConditions', tabindex: '-1').value('true')
$(".CheckBoxUI").value('true')
Following is the HTML
After mouse go over the check box additional text updated (marked in the screen shot)
You are attempting to check the box which has the attribute with value='true'
From the Geb manual:
The value of input, select and textarea elements can be retrieved and set with the value method. Calling value() with no arguments will return the String value of the first element in the Navigator. Calling value(value) will set the current value of all elements in the Navigator. The argument can be of any type and will be coerced to a String if necessary. The exceptions are that when setting a checkbox value the method expects a boolean (or, an existing checkbox value) and when setting a multiple select the method expects an array or Collection of values.
Try this:
$("#chkTermsConditions").value(true)
If you are using non standard HTML generated by some other platform. You may have to resort to clicking the element or using javascript.
The element that produces the desired click result could be one of the surrounding elements. If the widget is javascript controlled you may have to call a function that is embedded into the page for that widget. If its a javascript widget I cannot help you unless you can point me to a page which uses the same platform.
Try:
$('a[class=CheckRadioFocus]').click()
$('a[id=termLink]').click()
or any of the other surrounding elements.
I managed to check the check box with $(".CheckBoxStyle").click()
Only issue is still Submit button doesn't get enable. Following is the html code for before and after checking the check box in real situation.
I tried the to click on the submit button with following code. It doesn't give any error. But still doesn't move to next page as expected.May be because of Submit button disable issue.
$("#submitBtnMsg").click()
Edited :
It was turned out above was application related issue. We have to click on the address after selecting via address validation service. Then only Submit button get enable.
$(".RedColor").click()
Currently I use basic msi project in installshield.
I modify the destinaton dialog and add one checkbox on this dialog.
I want to use this checkbox's value in other place.
So how should I do?
Click on the checkbox you created in the dialog and you'll notice it has a Property and Value attribute. The Property is the name of the property that gets set when you check/uncheck the checkbox. The Property name should be in ALL CAPS to make it Public. It should also be listed in the SecureCustomProperties property to make it secure. ( Can pass from UI to Execute sequence during UAC/Elevated installation scenarios ) . The Value attribute says what the value of the Property is when it's checked. The unchecked value is always null/empty/unset.
If you need a different unchecked value you'll have to write a Set Property custom action that gives it a value when it doesn't have a value.
From there you can use it in other places ( such as Registry or XML changes ) by typing [PROPERTYNAME].
I wanted to put checkbox in my cognos 8 report based on some condition i.e if condition is true checkbox will appear with click mark and if it is not then without click mark.
I'm assuming you are placing this control on a prompt page...
It's kind of convoluted, but here's the only way I know how to do it. You can place 2 "Value Prompt" controls on your prompt page, and set the "Required" property to "No" on both. Set the "Parameter" property to be the same for both prompts (i.e., they will apply the same filter criteria on your query). For one of the prompts, set the "Default Selections" property so that your default value will be automatically selected on one of the controls. Also, be sure to set the "Select UI" property to "Check Box Group" (even if you only have one value to be checked) so you get a check box control.
Now that your controls are setup, you need to place them on your prompt page and apply a conditional render variable to both controls (you can look it up in Help if you aren't sure how to do this -- it's simple, but too lengthy to describe here). Basically, when your query condition is true, render the one with the check box clicked, otherwise render the one without. I not sure about the version support for the "Render Variable" property, but it works in version 8.4.
There isn't a way to my knowledge to dynamically select a default value on a prompt by linking it directly to a query -- You have to go through the conditional formatting/rendering approach.
yes i completely agree with jamey this is the only known way to do this.
there is another much difficult way to do it is by writing a java code which pretty much does tha same.
so i suggest you stick with jamey's solution.
as far as the version question comes, the 'render variable' property works the same in all versions of cognos 8 i.e. 8.2, 8.3 and 8.4.