UFT - JavaTable unable to get text - vbscript

I have this code for HP UFT v12.54
For itC = 0 To rwTbl - 1 Step 1
For itcC = 0 To clTbl - 1 Step 1
worksheet1.Cells(itC+1,itcC+1).value = objNPC_tp.GetCellData(itC, itcC)
Next
Next
The javatable has 5 columns, the output in my excel file is incomplete.
3 columns have the expected value that I want but the two other columns are empty.
It seems GetCellData is only able to get the text for cells with JavaEdit and JavaStaticText class. The other 2 column that have multiple class within a cell such as Links, Dropdowns, etc. GetCellData is unable to get the text value.
I also tried using childObjects without success.
Is there any other method I could try to get the text value from a cell inside a javatable?

Related

If value in column A of Sheet1 appears twice in column B of Sheet2, highlight value in Sheet1

Conditional Formatting - If a value in column A of sheet 1 appears twice in column b of sheet 2, highlight the cell in sheet 1
I've been messing with the indirect modifier to see if I can get this to work.
=COUNT(INDIRECT("'Order Confirmation'!B:B"),A1)
But this has currently just highlighted all the cells on sheet 1 column a. I have tried
=COUNT(INDIRECT("'Order Confirmation'!B:B"),A1>2)
=COUNT(INDIRECT("'Order Confirmation'!B:B"),A1=2)
and this has changed nothing. I would appreciate some assistance
if Sheet2 is like:
then Sheet1 will be like:
=FILTER(A1, COUNTIF(FILTER(INDIRECT("Sheet2!B:B"),
COUNTIF(INDIRECT("Sheet2!B:B"), INDIRECT("Sheet2!B:B"))>1), A1))
UPDATE:
=FILTER(A1, COUNTIF(FILTER(INDIRECT("'Order Confirmation'!B:B"),
COUNTIF(INDIRECT("'Order Confirmation'!B:B"),
INDIRECT("'Order Confirmation'!B:B"))>1), A1))
...as a custom formula because you have numbers in dataset not text

Issue with comparing 2 objects

I have 2 objects to be compared, when the first object contains a newly added element, after compare the two object difference should be showing one as difference.
i.e., object 1 as 3 data elements in the list, object 2 as 3 data elements in the list, now for object 1 a new elemts is added to the first position, when comparing it should have returned in the difference only the newly added elements, but all 3 elements shows as changed and last one as added.
Seems when index is changed the issue is appearing
Example below :
Original List
1
2
3
Modified List
0
1
2
3
Actual Result :
Value Changes as 1 -> 0 ,2 -> 1, 3 -> 2
Newly Added as 3
Expected Result
Newly added 0
, i tried with latest version javers-4.0.0-RC3, still same result .
Please suggest.
Answer to your question is the Javers doc
https://javers.org/documentation/diff-configuration/#list-algorithms

AddField function does not work as expected

I have the following block of code that iterates through the fields of each table and adds the fields of the current table respectively in order to create a number of tableboxes.
'iterate through every table
For i=1 To arrTCount
'the arrFF array holds the names of the fields of each table
arrFF = Split(arrFields(i), ", ")
arrFFCount = UBound(arrFF)
'create a tablebox
Set TB = ActiveDocument.Sheets("Main").CreateTableBox
'iterate through the fields of the array
For j=0 to (arrFFCount - 1)
'add the field to the tablebox
TB.AddField arrFF(j)
'Msgbox(arrFF(j))
Next
Set tboxprop = TB.GetProperties
tboxprop.Layout.Frame.ObjectId = "TB" + CStr(i)
TB.SetProperties tboxprop
Next
The above code creates the tableboxes, but with one field less every time (the last one is missing). If I change the For loop from For j=0 To (arrFFCount - 1) to For j=0 To (arrFFCount) it creates empty tableboxes and seems to execute forever. Regarding this change, I tested the field names with the Msgbox(arrFF(j)) command and it shows me the correct field names as I want them to be in the tableboxes in the UI of QlikView.
Does anybody have an idea of what seems to be the problem here? Can I do this in a different way?
To clarify the situation here and what I have tested so far, I have 11 tables to make tableboxes of and I have tried with just one of them or some of them. The result I am seeing with the code is on the left and what I am expecting to see is on the right of the following image. Please note that the number of fields vary for each table and the image has just one of them as an example.

How to remove values in spreadsheet B based on values in spreadsheet A?

I am working on automating a business process using excel macros in VB and I have it all completed except for one part. I have an inventory sheet that I would like updated upon running the macro. What it would do is search an order file for part numbers, compare those part numbers with the inventory sheet, and then remove inventory quantities within the inventory sheet based on the values found within the order sheet. These are in two separate workbooks. Here is an example of how it looks:
Spreadsheet A - Order Sheet:
A B C
Part #: Description: Quantity
123456 Item 1 1
1234567 Item 2 1
12345678 Item 3 1
Spreadsheet B - Inventory Sheet:
A B C
Part #: Description: Quantity
123456 Item 1 580
1234567 Item 2 790
12345678 Item 3 578
So this program would subtract values in Spreadsheet B - Column C based on the values in Spreadsheet A - Column C and Column A
In the order sheet even if a customer orders multiple items it shows each purchase as a separate item, so this program would only need to remove quantities of one at a time.
I'm rather new to this type of Excel Automation so any input would be greatly appreciated. I've been looking into Vlookup but from what I understand it only looks for information and displays existing values.
If the idea is to remove the "Orders" from the "Inventory" every time you run a macro, the right thing to do should be, in words, for each line in "Orders", search the corresponding object into the inventory and subtract the quantity.
In code, it's as easy as in words:
For j = 2 To Sheets("Orders").Range("A2").End(xlDown).Row
For k = 2 To Sheets("Inventory").Range("A2").End(xlDown).Row
If Sheets("Orders").Range("A" & j).Value = Sheets("Inventory").Range("A" & k).Value Then '<-- when the object is found
Sheets("Inventory").Range("C" & k).Value = Sheets("Inventory").Range("C" & k).Value - Sheets("Orders").Range("C" & j).Value '<-- subtract order's value
Exit For '<-- you don't need to loop any further after having found the object
End If
Next k
Next j
Press alt+f11
right click project on left and insert a module.
type in the mane code pane:
Public Sub UpdateInventory
'place some code like
for n1=0 to 1000
for n2=0 to 100
InventoryItemCode= Sheets("Inventory").range("A1").offset(n1,0).value
OrderCode=Sheets("Orders").range("A1").offset(n2,0).value
If InventoryItemCode=OrderCode then
'etc....
End if
Next n2
NEXT n1
End sub
see google for troubleshooting

How Can I Assign TabIndex in runtime in VB6

I am working in a VB6 maintenance application. It is a windows based application. My client wants to configure the controls tab index at runtime. I am saving the client setting to the access database.
The following sub sets the tab index of the controls
Private Sub SetTabSetting()
Dim i As Integer
Dim Ctr As Control
If UBound(TSetting) > 0 Then
For i = 0 To UBound(TSetting)
For Each Ctr In Me.Controls
Dim matched As Boolean: matched = False
If Ctr.Name = TSetting(i).ControlName Then
Ctr.TabIndex = TSetting(i).TabIndexNum
Exit For
End If
Next
Next
End If
End Sub
TSetting is a TYPE Array defined in a Global Module.
Private Sub Form_Load()
GetRATabSetting
SetRATabSetting
End Sub
GetRATabSetting is extracting the values from the database and populating into the TYPE arrray.
The code is getting executed quite fine. Even the values get extracted from the database and set to the controls correctly. But the tab is following the index what is set in the designtime.
Am I doing any mistake? Is it possible to set the tabindex of the controls at runtime ? Is there any other way to perform this ?
Suppose you have 5 controls on a form and their tab order is like this
Index - TabIndex
1 - 0
2 - 1
3 - 2
4 - 3
5 - 4
If you change 3 to 1 Then it will look like this
Index - TabIndex
1 - 0
2 - 2
3 - 1
4 - 3
5 - 4
Visual Basic will automatically bump up by one all tabindex equal to and higher than the one you assigned. There will never be a time where two controls have the same tabindex. This causes problems for routines that assign tab indexes like yours.
What you should do is not assign the tabindex directly from the database but rather build an array of control indexes associated with tab indexes. Sort it based on the tabindex and then start assigning, starting at whatever is at tabindex 0 (or the lowest).

Resources