Unable to select a value from a dropdown of windows form using AutoIt - vb.net

Using the following code
ControlCommand("Test Form", "", "[NAME:ctlMsgQueueCombo]", "ShowDropDown")
ControlSend("Test Form", "", "[NAME:ctlMsgQueueCombo]", "This is my default value (TEST) - First")
or
ControlCommand("Test Form", "", "[NAME:ctlMsgQueueCombo]", "ShowDropDown")
ControlSend("Test Form", "", "[NAME:ctlMsgQueueCombo]", "select", "This is my default value (TEST) - First")
It selects the combo box, but it is not selecting the desired "this is my default value (TEST) - First" from the list. Basically, it is selecting any value that starts with t. For example, the first value is "TMP". So instead of exactly matching it is selecting any first character match. How do I force it to select the exact string from the list?
I also tried using the following code, but nothing seems to work.
WinWaitActive($title)
$Index = _GUICtrlComboBoxEx_FindStringExact($hcombo, $sText)
_GUICtrlComboBoxEx_SetCurSel($hcombo, $Index)
or following
WinWaitActive($title)
$Index = _GUICtrlComboBox_FindStringExact($hcombo, $sText)
_GUICtrlComboBox_SelectString($hcombo, $Index)

Right now you are using ControlSend with incorrect parameters. The following will send the string 'select', and the last parameter will be evaluated to 0.
ControlSend("Test Form", "", "[NAME:ctlMsgQueueCombo]", "select", "This is my default value (TEST) - First")
As it expects 1 or 0 as the last parameter). Needless to say it's not what you want.
You should be doing something like SelectString with ControlCommand. You shouldn't have to show the dropdown first:
ControlCommand("Test Form", "", "[NAME:ctlMsgQueueCombo]", "SelectString", "This is my default value (TEST) - First")
I haven't been able to test that, but as long as it's finding the window and the string is correct then it should be fine.

Related

How to make all requirements start with the requirement ID (in brackets), in IBM Rational DOORS?

I have 3 attributes:
ID
Text
Is Requirement?
Here's an example of what I want:
Before:
ID Text Is Requirement?
AB45 3.1.2 Apples FALSE
AB46 All apples shall be red. TRUE
After:
ID Text Is Requirement?
AB45 3.1.2 Apples FALSE
AB46 [AB46] All apples shall be red. TRUE
Is there a programmatic way to add ID's to the front of the "Text", only if "Is Requirement?" is TRUE? If so, where exactly would the code go and how would you execute it? Would it be an additional DXL attribute?
Not directly. An attribute can either be calculated or manually filled, not both at the same time. Perhaps you might want to have two views, one "Edit view", one "Show Requirements View". In the latter, you will not show the main column (main column shows "Object Heading" and "Object Text"), but you will have a DXL Layout column with a code like this:
bool objIsReq = obj."Is Requirement?"
if (objIsReq) {
display "[" identifier(obj) "] " obj."Object Text" ""
} else {
if (!null obj."Object Heading""") then display number (obj) " - " obj."Object Heading"""
if (!null obj."Object Text""") then display obj."Object Text"""
}

Yii Change field name

I want to rename the field. Code is here
[['name'], 'unique', 'message' => 'This Make already exists'],
output
[
{
"field": "name",
"message": "This Make already exists"
}
]
how i change field? Result
"field" : "make"
Using fields(). In your model override fields() function as follows:
public function fields()
{
return['make'=>'name'];
}
This will change the name of the field from name to make but your name field will be the only field returned. You can do all the tricks you want to append to the fields returned, or change them using this function though. To know more about fields check: http://www.yiiframework.com/doc-2.0/yii-base-model.html#fields()-detail

Cloudant Search field was indexed without position data; cannot run PhraseQuery

I have the following Cloudant search index
"indexes": {
"search-cloud": {
"analyzer": "standard",
"index": "function(doc) {
if (doc.name) {
index("keywords", doc.name);
index("name", doc.name, {
"store": true,
"index": false
});
}
if (doc.type === "file" && doc.keywords) {
index("keywords", doc.keywords);
}
}"
}
}
For some reason when I search for specific phrases, I get an error:
Search failed: field "keywords" was indexed without position data; cannot run PhraseQuery (term=FIRSTWORD)
So If I search for FIRSTWORD SECONDWORD, it looks like I am getting an error on the first word.
NOTE: This does not happen to every search phrase I do.
Does anyone know why this would be happening?
doc.name and doc.keywords are just string.
doc.name is usually something like "2004/04/14 John Doe 1234 Document Folder"
doc.keywords is usually something random like "testing this again"
And the reason why I am storing name and keywords under the keywords index is because I want anyone to be able to search keywords or name by just typing on string value. Let me know if this is not the best practice.
Likely the problem is that some of your documents contain a keywords field with string values, while other documents contain a keywords field with a different type, probably an array. I believe that this scenario would result in the error that you received. Can you double check that all of the values for your keywords fields are, in fact, strings?

Java Google Sheets API example with autoResizeDimensionsRequest

I'm wondering how to use autoResizeDimensions in order to set the columns to auto resize. The following
List<Request> requests = new ArrayList<>();
AutoResizeDimensionsRequest autoResizeDimensions = new AutoResizeDimensionsRequest();
requests.add(new Request()
.setAutoResizeDimensions(autoResizeDimensions));
BatchUpdateSpreadsheetRequest batchUpdateRequest = new BatchUpdateSpreadsheetRequest()
.setRequests(requests);
SHEETS.spreadsheets().batchUpdate(spreadsheetId, batchUpdateRequest)
.execute();
returns the following error message
com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request
{
"code" : 400,
"errors" : [ {
"domain" : "global",
"message" : "Invalid requests[1].autoResizeDimensions: Only the COLUMNS dimension is supported",
"reason" : "badRequest"
} ],
"message" : "Invalid requests[1].autoResizeDimensions: Only the COLUMNS dimension is supported",
"status" : "INVALID_ARGUMENT"
I'm also interested in setting a specific width for a column. I haven't found any examples using java. If anyone has come across one or know how would love to no about it.
Additionally I've added setDimensions to that code
DimensionRange dimensions = new DimensionRange().setDimension("A1:C6");
with the setAutoResizeDimensions
requests.add(new Request()
.setAutoResizeDimensions(autoResizeDimensions
.setDimensions(dimensions)));
But I'm getting the following error
com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request
{
"code" : 400,
"errors" : [ {
"domain" : "global",
"message" : "Invalid value at 'requests[3].auto_resize_dimensions.dimensions.dimension' (TYPE_ENUM), \"A1:C6\"",
"reason" : "badRequest"
} ],
"message" : "Invalid value at 'requests[3].auto_resize_dimensions.dimensions.dimension' (TYPE_ENUM), \"A1:C6\"",
"status" : "INVALID_ARGUMENT"
Thanks
Conteh
The failures all stem from the same reason: AutoResizeDimensionRequest is not setup properly.
You need to supply a valid DimensionRange into the request's dimensions field in order for the request to know which dimensions to resize. The documentation for DimensionRange describes it's purpose: A range along a single dimension on a sheet. All indexes are zero-based. Indexes are half open: the start index is inclusive and the end index is exclusive. Missing indexes indicate the range is unbounded on that side.
The first error ("Invalid requests[1].autoResizeDimensions: Only the COLUMNS dimension is supported") is because the request is using the default DimensionRange, which means the DimensionRange.dimension field is using its default value of DIMENSION_UNSPECIFIED. The field is an enum of type Dimension whose default value is DIMENSION_UNSPECIFIED. So the error message is saying, "Only COLUMNS is supported" and is implicitly saying, "... but you supplied DIMENSION_UNSPECIFIED or ROWS".
The second error ("Invalid value at 'requests[3].auto_resize_dimensions.dimensions.dimension' (TYPE_ENUM), \"A1:C6\"") is because you wrote an A1 range into the dimension field. The error message is saying: "You gave me an invalid value. I am an enum, but you gave me A1:C6, and that isn't a valid enum."
The valid values for dimension are ROWS or COLUMNS (and AutoResizeDimensionRequest requires that you specify COLUMNS). In addition, you'll want to specify the sheetId (the ID of the sheet whose columns you want to resize) and a startIndex and endIndex of which columns you want to resize.
For example, if you wanted to automatically resize rows 0 and 1, you would use:
AutoResizeDimensionsRequest autoResizeDimensions = new AutoResizeDimensionsRequest();
DimensionRange dimensions = new DimensionRange().setDimension("COLUMNS").setStartIndex(0).setEndIndex(2);
autoResizeDimensions.setDimensions(dimensions);
(endIndex is 2 because end indexes are exclusive, whereas start indexes are inclusive.)

datatables: include space in filter string

I have an alphanumeric column with strings like "1, 2, 2".
When I type "1, 2, 2" in the search, it seems to be returning all cells with "1," and "2,".
What can I do so the search returns only "1, 2, 2"?
Using Datatables 1.9
Turn smart filtering off, bRegex as true treats search string as regular expression:
"oSearch": { "bSmart": false, "bRegex": true }
Sorry, I am not allowed to comment on the previous answer.
In the documetation
Options (legacy documentation for DataTables v1.9) says:
"As an object the "sSearch" parameter must be defined, but all other parameters are optional."
If you do not define it, you can eventually get the error
"a.oPreviousSearch.sSearch is undefined".
Then add sSearch to bSmart and bRegex parameters:
"oSearch": {
"bSmart": false,
"bRegex": true,
"sSearch": ""
}
I have tried the above code but the below code worked for me,
initComplete: function () {
$('.dataTables_filter input').bind('keyup', function (e) { if (e.keyCode == 32) this.value += ' '; });
}