FILTER values from one sheet when not present on another - filter

I'm trying to compare Items in "projectEstimate!D2:D & projectEstimate!E2:E" to Items in 'itemsAssociations!C3:C & itemsAssociations!D3:D" for matches.
If there is a match, confirm that the associated item (itemsAssociations!G3:G & itemsAssociations!H3:H) is not already listed in "projectEstimate".
If it is not listed, print that item. If it IS listed, do nothing.
I put together the following code which seems like it should work, but the item prints whether it's present on projectEstimate or not.
=ArrayFormula({itemsAssociations!I2:J2;FILTER(itemsAssociations!I3:J,
{projectEstimate!D2:D&IF(LEN(projectEstimate!E2:E),projectEstimate!E2:E,)=itemsAssociations!C3:C&IF(LEN(itemsAssociations!D3:D),itemsAssociations!D3:D,)},
{projectEstimate!D2:D&IF(LEN(projectEstimate!E2:E),projectEstimate!E2:E,)<>itemsAssociations!G3:G&IF(LEN(itemsAssociations!H3:H),itemsAssociations!H3:H,)}
)})
I also tried this QUERY, but not sure how to include the entire ranges
=QUERY(itemsAssociations!C3:J,"SELECT I,J WHERE C = '"&projectEstimate!D2:D&"' AND D = '"&projectEstimate!E2:E&"' AND J != '"&projectEstimate!D2:D&"'",0)
This is close, but the opposite result:
=FILTER(projectEstimate!D2:D,COUNTIF(FILTER(itemsAssociations!J3:J,COUNTIF(itemsAssociations!C3:C&itemsAssociations!D3:D,itemsAssociations!C3:C&itemsAssociations!D3:D)),projectEstimate!D2:D))
My sheet

it would be something amongst theses lines:
=ARRAYFORMULA(REGEXREPLACE(QUERY(FILTER(projectEstimate!D2:D&":"&projectEstimate!E2:E,
NOT(COUNTIF(itemsAssociations!C3:C&":"&itemsAssociations!D2:D,projectEstimate!D2:D&":"&projectEstimate!E2:E))),
"where Col1 is not null", 0), ":$", ))

This is what I came up with...
=IFERROR(FILTER(FILTER(itemsAssociations!J3:J,NOT(COUNTIF(projectEstimate!D3:D,itemsAssociations!C3:C))),NOT(COUNTIF(FILTER(projectEstimate!D2:E,NOT(COUNTIF(itemsAssociations!C3:C&itemsAssociations!D3:D,projectEstimate!D2:D&projectEstimate!E2:E))),FILTER(itemsAssociations!J3:J,NOT(COUNTIF(projectEstimate!D3:D,itemsAssociations!C3:C)))))),"No suggested items!")

Related

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.

LotusScript: how to iterate numbered fields with for loop

I'm using LotusScript to clean and export values from a form to a csv file. In the form there are multiple date fields with names like enddate_1, enddate_2, enddate_3, etc.
These date fields are Data Type: Text when empty, but Data Type: Time/Date when filled.
To get the values as string in the csv without errors, I did the following (working):
If Isdate(doc.enddate_1) Then
enddate_1 = Format(doc.enddate_1,"dd-mm-yyyy")
Else
enddate_1 = doc.enddate_1(0)
End If
But to do such a code block for each date field didnt feel right.
Tried the following, but that isnt working.
For i% = 1 To 9
If Isdate(doc.enddate_i%) Then
enddate_i% = Format(doc.enddate_i%,"dd-mm-yyyy")
Else
enddate_i% = doc.enddate_i%(0)
End If
Next
Any suggestions how to iterate numbered fields with a for loop or otherwise?
To iterate numbered fields with a for loop or otherwise?
valueArray = notesDocument.GetItemValue( itemName$ )
however do you know that there is a possibility to export documents in CSV format using Notes Menu?
File\Exort
Also there is a formula:
#Command([FileExport]; "Comma Separated Value"; "c:\document.csv")
Combined solution of Dmytro, clarification of Richard Schwartz with my block of code to a working solution. Tried it as an edit on solution of Dmytro, but was rejected.
My problem was not only to iterate the numbered fields, but also store the values in an iterative way to easily retrieve them later. This I found out today trying to implement the solution of Dmytro combined with the clarification of Richard Schwartz. Used a List to solve it completely.
The working solution for me now is:
Dim enddate$ List
For i% = 1 To 9
itemName$ = "enddate_" + CStr(i%)
If Isdate(doc.GetItemValue(itemName$)) Then
enddate$(i%) = Format(doc.GetItemValue(itemName$),"dd-mm-yyyy")
Else
enddate$(i%) = doc.GetItemValue(itemName$)(0)
End If
Next

Excel Mac VBA Loop Through Cells and reset some values

I currently have a worksheet that I have multiple people filling out every day. There are 4 columns that the users fill out: C, E, H, & J (all numerical values, one row per day of the month.)
The users fill in C, E, & H every day no matter what, but a lot of days there is no value to put in column J. I need the value in J to be set to 0 if the user doesn't enter anything. Of course it would be easier to just have the users enter 0, but I'm working with a complicated group of people here.
Anyway, I want to use a macro that runs automatically when the user clicks the save button (before it actually saves, of course), and have it do the following: (I am more familiar with php, so I'm just typing this out how I'm familiar - I'm sure my syntax is incorrect)
Foreach Row
If "column A" != "" {
If "column J" != "" {
//Everything is good, continue on...
} else {
CurrentRow.ColumnJ.value == 0
}//Value has been set - continue loop
}
//column A is blank, this day hasn't come yet - quit looping here
End Foreach
If anyone could help me out with this I'd appreciate it. With some research, this is what I've come up with so far, and now I'm stuckā€¦
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim curCell As Range
'Labor Flow Sheet'.Select
For Each curCell in Range( ???? )
If curCell.Value = "" Then
???????
End If
Next curCell
End Sub
Thanks in advance!
See this link about finding the right range, and as for the question marks inside the If statement, you would want to put
curCell.Value = 0
For the question marks in your statement
For Each curCell in Range( ???? )
Solution 1:
To find the full range you're working with, you'll need to use a column that is filled out each day. You mentioned columns C, E, and H were filled out every day. Using one of those columns (let's pick C for the example here), you could find the range by using the .end method. This goes out either up down left or right from a range until it doesn't find any data. So,
Range("J1", Range("C1").End(xlDown)).Select
will select all cells from J1 (or whatever column is the last in your sheet) to the bottom-most cell containing data in column C, automatically.
Solution 2:
Manually put in the range. For example, to choose A1 to J300:
Range("A1", "J300").Select

How can i set mark for textView?

i am doing "find and repleace button" for my application. I am using gtk and ruby. And i can find that how many word, if there is. Also i want to get selection word that searched word, and i should mark them. My some code:
def search(ent, txtvu)
start = txtvu.buffer.start_iter
first, last = start.forward_search(ent.text, Gtk::TextIter::SEARCH_TEXT_ONLY, nil)
count = 0
while (first)
mark = start.buffer.create_mark(nil, first, false)
txtvu.scroll_mark_onscreen(mark)
txtvu.buffer.delete_mark(mark)
txtvu.buffer.select_range(first, last)
start.forward_char
first, last = start.forward_search(ent.text, Gtk::TextIter::SEARCH_TEXT_ONLY, nil)
start = first
count += 1
end
count says me how many words involve My code does't work. :( Why? I want to mark all searched words.
If I understand you correctly, you want to highlight all found words, not just one. In that case, select_range is not the function to call, because it will change the selection to the current word, and GtkTextView selection is single and contiguous.
Instead, create a highlight tag and apply it to all searches. For example:
# create the "highlight" tag (run this only once)
textvu.buffer.create_tag("highlight", {background => "yellow"})
# ... later, in the loop:
textvu.buffer.apply_tag("highlight", first, last)
Your matches will all appear highlighted.

QTP narrow a list of ChildObjects

[The description is a bit fudged to obfuscate my real work for confidentiality reasons]
I'm working on a QTP test for a web page where there are multiple HTML tables of items. Items that are available have a clickable item#, while those that aren't active have an item# as plain text.
So if I have a set of ChildObjects like this:
//This is the set of table rows that contain item numbers, active or not.
objItemRows = Browser("browserX").Page("pageY").ChildObjects("class:=ItemRow")
What is the simplest way in QTP land to select only the clickable link-ized item #s?
UPDATE: The point here isn't to select the rows themselves, it's to select only the rows that have items in them (as opposed to header/footer rows in each table). If I understand this correctly, I could then use objItemRows.Count to count how many items (available and unavailable) there are. Could I then use something like
desItemLink = Description.Create
desItemLink("micclass").value = "Link"
objItemLinks = objItemRows.ChildObjects(desItemLink)
To get the links within only the item rows?
Hope that clarifies things, and thanks for the help.
I think I have this figured out.
Set desItemLink = description.create
desItemLink("micclass").value = "Link"
desItemLink("text").RegularExpression = True
//True, Regex isn't really required in this example, but I just wanted to show it could be used this way
//This next part depends on the format of the item numbers, in my case, it's [0-9]0000[0-9]00[0-9]
For x = 0 to 9
For y = 0 to 9
For z = 0 to 9
strItemLink = x & "0000" & y & "00" & z
desItemLink("text").value = strItemLink
Set objItemLink = Browser("browser").Page("page").Link(desItemLink)
If objItemLink.Exist(0) Then
//Do stuff
End If
Next
Next
Next
Thanks for your help anyways, but the code above will iterate through links with names in a given incrementing format.

Resources