openoffice calc macro access current selection of a validation list - validation

i have an openoffice dropdown select using list validation.
the problem is, that the list contains duplicate entries in a flat tree form - like:
Test 1
Subtest
Test 2
Subtest
Now i would like to Convert the selected values to something like "Test 1 - Subtest", "Test 2 - Subtest" etc.
Is there a simple way to do this with an OpenOffice Macro? Or is there at least a way to get the Position of the currently selected Element for a cell.Validation ?

There should be a 'Unique' option that could be activated for not allowing repetitions.

Related

Google Sheets getting Invalid error in drop down but item is on the list

In Google Sheets, I created a data validation cell to select different time slots. I am getting an error when choosing 6:00, 7:00, 8:00, 9:00 even tho all of them are in the list. Error says: "Invalid: Input must be an item on the specified list"
Added the data validation like this:
Thanks a lot in advance!
The file is here: https://docs.google.com/spreadsheets/d/1NSBx87sWScwe2Vtp9FOcH3BupvPJ_jzISUeAk6gSBOM/edit#gid=612415402
Make sure to actually pick a choice on the dropdown OR your input is exactly the same with the choice.
By default, when you manually enter 6:00-9:00 it automatically adds 0 in the beginning as sheets has detected your input as time.
So you should update your data validation list to use 06:00-09:00 instead so it matches when sheets adjusts your input when they are manually entered.

UFT/QTP - Extract Values From List Within WebEdit

I am attempting to capture all the list items in the WebList elements throughout the entire application, however, while below code works on the WebLists, it does not work on this WebEdit.
When you click on the WebEdit, a long list of values appear (similar to a WebList) and as you type for your value, the list becomes shorter. That is how the WebEdit was set up.
But now, how do I get the values in this list?
Here is the code I have for the WebLists:
Code
Set WebLink = Browser("browser").Page("page")
listval = WebLink.WebElement("xpath:= ((//*[contains(text(), 'Name')]))[1]/following::SELECT[1]").GetROProperty("all items")
listvalues = split(listval,";")
For j = LBound(listvalues,1) To UBound(listvalues,1)
'Print listvalues(j)
writeToTextFile(listvalues(j))
Next
ExitTest
The short answer is: it depends on the implementation.
The long one:
There is no universal widget for comboboxes (Like there is for edit fields or lists / selects, radiobuttons etc) => there is no universal solution but only guidelines.
You need to spy on those objects that appear in the combobox, see their XPath and / or other properties (the css classname they belong to, for example) and then execute a second query that selects all such items. Afterwards you have to extract the value of the selected elements; which might be as simple as getting the innertext Property or you may need to dig even deeper in the HTML hierarchies.
You would need to pay careful attention for synchronisation(Waiting until all search result elements appear), Filtering (using the XPath, Description Objects and ChildObjects method on your WebPage) and then extraction( getting the property /element that contains the actual value of that WebElement)
So again: These combobox solutions are not universal therefore without seeing their code the best what one can provide to you is universal guidelines which should work in most of the situations. (You would need some familiarity with Web Programming and the UFT Framework / Robot)

UFT - Select File from TreeView

I have recorded a script to Click on an XML file(highlight, right-click and open) from a popup treeview, the popup contains a number of files(varying amounts/types and they can appear in any order), the one I will always want to select always begins with 'AB', the numerics of the filename will change per test however:
SwfWindow("APPMAIN").SwfWindow("2000HOME").SwfTreeView("MainTreeList").SelectCell "AB99872","Object Name"
SwfWindow("APP-MAIN").SwfToolbar("SwfToolbar").Select "Open"
After Recording, I run the script, but I get the following error:
SelectCell :SelectCell :Cannot identify the specified item = AB99872 of the TreeView.
So my question is 2 part:
Why can it not select the file AB99872 after the initial record using SelectCell?
Considering that the filename will change per test(ie... AB*), what is the best way to automate this to be robust enough to select any Filename beginning with 'AB'. I did try UI Automation/Object Recognition and I used a regular expression like ^AB.* but UFT(v12.54) continually crashed with this approach.
You can use the tree's GetContent method and then use regular expressions to find the name of the node to select (then use that value in SelectCell.

VBS (MSGBOX)- How can I add multiple attribute numbers (such as 16)

I want to create a VBS script that has a message box with multiple numerical attributes,
for example having a message box with the 16 icon as well as the 2 value (Abort,Retry,Ignore)
In other words, I would want to combine the following two scripts into one.
lol=msgbox("Body message",16,"Title")
with
lol=msgbox("Body message",2,"Title")
How do I get to combine these two attributes?
You just add the numbers together:
lol=msgbox("Body message",18,"Title")

Drop-down validation list created dynamically

In range A1 I have a drop-down validation list. Based on the user's selection from that list I would like to dynamically create a new drop-down validation list in range C1.
For instance, in A1 the list contains:
A
B
C
So if the user selects A from the list, the new list in C1 contains:
1) Annoying Orange
2) Angry Birds
3) Arbitrary Sample
If the user selects B, the new list contains:
1) Bloated Code
2) Better Left Unsaid
3) Bad Attempt
etc
Easy enough to do using VBA. But in GAS.... I have absolutely no idea of how to even start :/
The Apps Script API for data validation was just released:
http://googleappsdeveloper.blogspot.com/2013/08/answering-another-top-request-data.html
You could follow the example in the accepted answer to Google spreadsheet Script Create Data Validation in certain range.
... up until last week, it would have worked. Unfortunately, the Data Validation class and related Range methods getDataValidation() and setDataValidation() have disappeared.
Your only avenue at this point is to visit Issue 2958 and star it, so you receive updates if & when the API is refreshed.

Resources