I'm new in Lotus Notes programming and I need your advices and your help.
My main form contains a table with 8 rows and 2 columns. ( there are 16 cells ) Every each cell has a numeric field. My fields name are :
txt_n1 and txt_i1 ( for 1st row )
txt_n2 and txt_i2 ( for 2nd row )
....
txt_n8 and txt_i8 ( for 8th row )
What I want to do is:
I have a view called vwMarketing with just one column. I want this view to display only those docs. in which there is at least one or more rows which its cells contains equal values.
So, if let say txt_n4 = txt_i4 => OK
row(k) (where k=1..8) : if cell 1 value is 5 and cell 2 value is 5 => OK.
There could be more than one row with this property, important is to exist at least one, and the values not to be null.
I hoped i was pretty clear, thanks !
PS: Actually, the formula statement i want to be in the column, so if it is OK => "A" and if not => "" ( in the view property, I checked : Don't show empty categories )
if you have small amount of documents in the view, then as u were suggested use Selection Formula to exclude documents with wrong condition.
you can add computed item/flag into your documents, field will compute if the document should be displayed in the view or not. then you will not have performance issue. i.e.
but code you need should look like that (that will check if documents is fine to be displayed in view or not), if you use it in view - just put after all Select _res = 1 otherwise if you decide to use flag into document (to increase performance) then Select youritem = 1
_res := 0;
#For(i:=1;i<=8;i:=i+1;
_post := #Text(i);
_txt_n := #GetField("txt_n"+_post);
_txt_i := #Text(#GetField("txt_i"+_post));
#If( (_txt_n=_txt_i) & (_txt_n!="");
#Do( _res := 1; i:=9);
0
)
);
_res
I would solve it slightly different:
Create a hidden text field on your form called 'DisplayInView' (or similar).
Modify the view selection: SELECT DisplayInView="Yes"
Add the code below to the PostSave event of your form:
Dim thisdoc As NotesDocument
Dim isSame As Boolean
isSame = False
Set thisdoc = source.Document
'*** Loop through all fields in document and compare the field pairs
Forall i In thisdoc.Items
If Left(i.Name,5) = "txt_n" Then
If i.Text = thisdoc.GetItemValue( Replace(i.Name,"txt_n","txt_i") )(0) Then
isSame = True
Exit Forall
End If
End If
End Forall
If isSame Then
Call doc.ReplaceItemValue("DisplayInView","Yes")
Call doc.Save(True,False)
End If
I haven't tested it, but I believe it should work.
Related
As per need, I want to select the Second Row from FlightsGrid Image shown below.
Applying below Code, I am getting RowCount as 6 but not able to click on 3rd Row.
Set ODesc = Description.Create
oDesc("micclass").value = "WpfTable"
Set objchild = WpfWindow("HPMyFlightSampleApplication").WpfTable("Table_FlightsGrid")
objCount = objchild.rowcount
objCount(2).click
Image from Flight Reservation Application:
The WpfTable object is not a collection, it doesn't support indexing. Did you try using its SelectRow method?
First, why are you using DP here if you are able to get row count of table.
Following two lines will give you row count of the table:
Set objchild = WpfWindow("HPMyFlightSampleApplication").WpfTable("Table_FlightsGrid")
objCount = objchild.rowcount
Second, try using its SelectRow method to select required row.
As #Motti suggested, you can use SelectRow. Or if you want to go more in depth and want to select particular cell (which will eventually select the entire row), you can use SelectCell like this way:
'Rows and Columns indexes are 0-based
iCols = WpfWindow("devname:=HPE MyFlight Sample Application").WpfTable("devname:=flightsDataGrid").ColumnCount
iRows = WpfWindow("devname:=HPE MyFlight Sample Application").WpfTable("devname:=flightsDataGrid").RowCount
sFlightNum = "12274 NW"
For i = 0 To iRows
If WpfWindow("devname:=HPE MyFlight Sample Application").WpfTable("devname:=flightsDataGrid").GetCellData(i, 4) = sFlightNum Then
WpfWindow("devname:=HPE MyFlight Sample Application").WpfTable("devname:=flightsDataGrid").SelectCell i, 4
Exit For
End If
Next
Here is the screenshot:
DB = Oracle 11g
Apex = 4.2.6
In the form I have various items which all work great. However I now have a set of check boxes(:P14_DAYS) one for each day of the week.
What I need to do is get all records between :P14_START_DATE :P14_END_DATE, but only within the days select that's checked.
Below is also a sample of the DATE_SETS table
http://i.stack.imgur.com/YAckN.png
so for example
dates 01-AUG-14 - 5-AUG-14 But only require Sundays AND Mondays date would bring back 2 refs.
BEGIN
UPDATE MD_TS_DETAIL
SET job_for = :P14_JOBFORTEM,
job_type_id = :P14_JOB_TYPE_VALUE,
account_id = :P14_ACC_VAL,
qty = :P14_HRS,
rio = :P14_RIO,
post_code = :P14_POSTCODE
WHERE id IN (SELECT D.id
FROM MD_TS_MAST M
LEFT JOIN MD_TS_DETAIL D
ON M.mast_id = D.md_id
LEFT JOIN DATE_SETS
ON ms_date = dt
WHERE eng_id = :P14_ENG_VAL
AND ms_date BETWEEN :P14_START_DATE AND :P14_END_DATE
AND DATE_SETS.col_day = ANY instr(':'||:P14_DAYS||':',Return)
END;
Any help would be much appreciated .
I found this example: http://docs.oracle.com/cd/B31036_01/doc/appdev.22/b28839/check_box.htm#CHDBGDJH
As I can understand, when you choose some values in your checkbox list, item :P14_DAYS receives value, that contains return values of chosen elements of the LOV with delimiters. Then you need to replace this string in your query
AND DATE_SETS.col_day = ANY instr(':'||:P14_DAYS||':',Return)
with
AND instr(':'||:P14_DAYS||':', ':'||DATE_SETS.col_day||':') > 0
Here function instr searches substring DATE_SETS.col_day in string :P14_DAYS. It returns position of substring if substring was found or 0, if not found. Then you compare result of function with 0, and if result > 0, it means that DATE_SETS.col_day is among selected values.
I have a problem that gives me some headaches lately. I hope I can find a solution with your help.
I have a view : "vwTest" which is embedded on a form. It is an editable view. The view has 3 columns: Number , Cost , Difference. All the 3 columns have as their default values some field names which exist on a form called "fmTest", the field names are: Number , Cost , Difference.
On the main form ( which contains the view ) there is a field ( computed ) called: TotalValue.
The view has 2 actions: AddLine and DeleteLine.
What I want to do is:
Let say TotalValue = 5000
user complete the first line of the view:
Number | Cost | Difference
1 | 50 | 4950 => The 3rd column value to be calculated automatically as the difference between 5000 ( TotalValue ) and 50 ( the value of the 2nd column )
user complete the second line of the view:
2 | 60 | 4890 => the 3rd column value to be calculated automatically as the difference between the last 3rd column value from the view and 60 ( the current value of the 2nd column )
I think that's like a recursive algorithm.
The value of TotalValue exists, it is a Number type field.
Hope to find a solution and resolve this problem! I really appreciate your help and time!
After every save you have to cylce through all entries belonging to "this" main document and recalculate the totals. I assume, that the "lines" are response- documents to the main document and that the Embedded view is categorized by the unid of the main document...
Dim ses as New NotesSession
Dim db as NotesDatabase
Dim viewEmbedded as NotesView
Dim viwNav as NotesViewNavigator
Dim ve as NotesViewEntry
Dim docLine as NotesDocument
Dim docMain as NotesDocument
Dim dblTotal as Double
Set db = ses.CurrentDatabase
Set docMain = ... 'somehow get the main document, therefor I would need your current code
dblTotal = docMain.TotalValue(0)
Set viewEmbedded = db.Getview( "vwTest" )
viewEmbedded.AutoUpdate = False
Set viwNav = viwEmbedded.CreateViewNavFromCategory( docMain.UniversalID )
Set ve = viwNav.getFirst()
While Not ve is Nothing
Set docLine = ve.Document
dblTotal = dblTotal - docLine.Cost(0)
If dblTotal <> docLine.Difference(0) then
docLine.Difference = dblTotal
Call docLine.Save( true, true )
End If
Set ve = viwNav.getnextDocument(ve)
Wend
Why the loop? What if someone modifies the first line after a second one and a third one have been created? then the total for 2, 3 and all subsequent lines has to change.
This code was not typed in Designer and might contain typos. It does NOT contain any error- handling and can produce Replication / Save- Conflicts if not used carefully..
Hope that helps
am using two datatable named as dnddatatable and dtdup . it contains set of phone numbers . I want to compare 2nd datatable with first datatable and remove the values from datatable1(name as dnddatatable)values which are equal to 2nd datatable name as(dtdup).
data in the datatable as follows.
dnddatatable(data table1)
phone
9865015695
9840903331
98668625
800971868
809679532
837445478
dtdup(dtata table2)
phone_numbers
9865015695
9840903331
result dnddatatable(data table1)
98668625
800971868
809679532
837445478
I answered a pretty similar question time ago, the idea is exactly the same
For i As Integer = 0 To dataset.Tables(0).Rows.Count - 1
Dim found As Boolean = False
For j As Integer = 0 To dataset1.Tables(0).Rows.Count - 1
If dataset.Tables(0).Rows(i)(0).ToString = dataset1.Tables(0).Rows(j) (0).ToString Then
found = True
End If
Next
If found = False Then
'here you are getting the right result in each loop
'in this example i'm showing the result in a textbox
'just change the instruction and write them in your note pad or wherever you want to
MsgBox(dataset.Tables(0).Rows(i)(0).ToString)
End If
Next
So i have FlexGrid in my VB6 project I'm working on. It has names on each row, and I have a drop down so the user can select what name they want to see more info for, here is what I have.
Dim target_name As String
Dim r As Integer
' Get the name.
target_name = Combo1
If Len(target_name) = 0 Then Exit Sub
' Search for the name, skipping the column heading row.
target_name = LCase$(target_name)
For r = 1 To MSFlexGrid1.Rows - 1
If LCase$(MSFlexGrid1.TextMatrix(r, 0)) = _
target_name Then
' We found the target. Select this row.
MSFlexGrid1.Row = r
MSFlexGrid1.RowSel = r
MSFlexGrid1.Col = 0
MSFlexGrid1.ColSel = MSFlexGrid1.Cols - 1
' Make the row visible.
MSFlexGrid1.TopRow = r
Exit Sub
End If
Next r
That works well, but it shows everything below that name too, I would like it to single out only the name selected.
Any help would be great.
What's the data source of your grid? You can place the filter on the data grid data source, so that as the user chooses the name from your drop down only the selected persons details are returned from the datasource to the grid.
Not exactly what you were asking, but its how I would achieve the result you are wanting.
P.S. I have used FlexGrid in VB6 and I don't know of a way to do what you are asking on the grid (might be there but I never noticed it).