Create Custom Data Entry Form/Dialog

What I need to do is to allow my users to enter a value for one field for every record in a view. I need the user to be able to enter this information very quickly. I thought about doing this through an Editable column in the view but it takes too long to enter edit mode in the view. The number of entries in the view can vary and I dont know what the maximum number is going to be.

Is there a way where a user can be presented with a custom form or dialog box that would take all the values from a column in a view and give the user a data entry field next to the value from that column?

I am basically looking for an entry method similar to Excel but for Lotus Notes.... I would create a form and have them enter information into the form but I dont know how many field to put into the form as the maximum.

Any ideas??
TheBull369Asked:
Who is Participating?
 
marilyngConnect With a Mentor Commented:
Yeah, basically, you have the button on the view action bar.
YOu could have done this, you know.. fairly easy once you think about it.  

the dialog box has the saveOptions field set to "0"
it has the DocID, RecNo, ItemName, Quantity and I used Quantity_1 for the changed Quantity.

PostOpen Event:...................................................................
'Basically grabs the first document in the view.
Sub Postopen(Source As Notesuidocument)
      Dim Session As New NotesSession
      Dim db As NotesDatabase
      Set db = session.currentdatabase      
      Dim doc As NotesDocument, ludoc As Notesdocument
      Set doc = source.document
      Dim view As NotesView
      Set view = db.getView("theBull")
      Set ludoc = view.GetNthDocument(1)
      If Not ludoc Is Nothing Then
            With doc
                  .docid = ludoc.Universalid
                  .RecNo = 1
                  .ItemName = ludoc.ItemName(0)
                  .Quantity = ludoc.quantity
                  .quantity_1 = ""
                  .computewithform False, False
            End With
      End If
      source.GotoField("Quantity_1")
      
End Sub

Next Button...............................................................
Sub Click(Source As Button)
      Dim Session As New NotesSession
      Dim ws As New NotesUIWorkspace
      Dim uidoc As NotesUIDocument
      Set uidoc = ws.currentdocument
      Dim db As NotesDatabase
      Set db = session.currentdatabase
      Dim doc As NotesDocument
      Dim ludoc As NotesDocument
      Dim view As NotesView
      Set view = db.GetView("thebull")      
      Dim RecNo As Integer
      Dim Quantity As Double
      Dim Quantity_1 As String
      Set doc =  uidoc.Document
      
      'this open document
      RecNo =doc.RecNo(0)
      DocID = doc.DocID(0)      
      Quantity = doc.Quantity(0)
      Quantity_1 = doc.Quantity_1(0)
      'Now see if the original document needs to be updated
      If quantity_1<>"" Then
            If Cdbl(Quantity_1)<> Cdbl(Quantity) Then
                  Set ludoc = db.GetDocumentByUnid(DocID)
                  If Not ludoc Is Nothing Then
                        ludoc.Quantity = Cdbl(Quantity_1)
                        ludoc.save True, False, True
                  End If
            End If
      End If
      'Now increment the recNo and find the next document in the view            
      Set ludoc = Nothing
      view.Refresh
      RecNo = recNO +1
      Set ludoc = view.GetNthDocument(recNo)
      If Not ludoc Is Nothing Then
            'do nothing
            doc.docID = ludoc.UniversalID
            doc.RecNo = recNo
            doc.ItemName = ludoc.ItemName(0)
            doc.Quantity  = ludoc.Quantity(0)
            doc.Quantity_1 = ""
            uidoc.GotoField("Quantity_1")
            uidoc.refresh
      Else
            Msgbox "Sorry, there are no more records in this direction",,"End of LIne"            
            Exit Sub            
      End If
End Sub

----------------
Previous Button is similar..............................................................................
Sub Click(Source As Button)
      Dim Session As New NotesSession
      Dim ws As New NotesUIWorkspace
      Dim uidoc As NotesUIDocument
      Set uidoc = ws.currentdocument
      Dim db As NotesDatabase
      Set db = session.currentdatabase
      Dim doc As NotesDocument
      Dim ludoc As NotesDocument
      Dim view As NotesView
      Set view = db.GetView("thebull")      
      Dim RecNo As Integer
      Dim Quantity As Double
      Dim Quantity_1 As String
      Set doc =  uidoc.Document
      
      'this open document
      RecNo =doc.RecNo(0)
      DocID = doc.DocID(0)      
      Quantity = doc.Quantity(0)
      Quantity_1 = doc.Quantity_1(0)
      'Now see if the original document needs to be updated
      If quantity_1<>"" Then
            If Cdbl(Quantity_1)<> Cdbl(Quantity) Then
                  Set ludoc = db.GetDocumentByUnid(DocID)
                  If Not ludoc Is Nothing Then
                        ludoc.Quantity = Cdbl(Quantity_1)
                        ludoc.save True, False, True
                  End If
            End If
      End If
      'Now increment the recNo and find the next document in the view            
      Set ludoc = Nothing
      view.Refresh
      RecNo = recNo -1
      If RecNo <1 Then
            Msgbox "Sorry, you are already at the beginning of the view",,"At the Beginning"            
      End If
      Set ludoc = view.GetNthDocument(recNo)
      If Not ludoc Is Nothing Then
            'do nothing
            doc.docID = ludoc.UniversalID
            doc.RecNo = recNo
            doc.ItemName = ludoc.ItemName(0)
            doc.Quantity  = ludoc.Quantity(0)
            doc.Quantity_1 = ""
            uidoc.GotoField("Quantity_1")
            uidoc.refresh
      Else
            Msgbox "Sorry, there are no more records in this direction",,"End of LIne"            
            Exit Sub            
      End If
End Sub
-------------------------------------------------------------
View Action button opens a dialog box:

@DialogBox("bulldialog"; [AUTOHORZFIT] : [AUTOVERTFIT] : [NONEWFIELDS] : [NOFIELDUPDATE] : [SIZETOTABLE] ; "Quantity Update" )



------------

Although I'm sure that others will have suggestions to streamline, like use view entries, or formulas for next and prev... :)  This is rough.
0
 
marilyngCommented:
Other than killing the 64K limit?
Question..

Column: a:b:c:b:g:h:j:a:a:a:c:c:c:

So, are we talking about changing all the a's to zz, the b's to yy, the c's to xx, the g's to ww.. and so on, or change the entire column to a different value?

Your dialog box would have to have a "base" field that does an @Unique(dbcolumn) lookup of the column:

a:b:c:b:g:h:j:a:a:a:c:c:c:  < real column.

a:b:c:b:g:h:j  <Unique value

view sorted by your a:b:c: column

Dialog box with two fields and a button;  First field select a value to be changed, second field, enter the change value.

Button:  GO

Dim session as New NotesSession
Dim db as NotesDatabase
set db = session.currentdatabase
Dim ws as New NotesUIWorkspace
Dim uidoc as NotesUIDocument
dim doc as NotesDocument
set doc = ws.currentdocument.document
Dim view as NotesView
Set view = db.getView("lookupView")

Dim Key as String
Dim ReplaceValue as String
Dim coll as NotesDocumentCollection

key = doc.getItemValue("SelectedValue")(0)
ReplaceValue = doc.getItemValue("Replacevalue")(0)

set coll = view.getalldocumentsbykey(key, True)
if coll.count>0 then
  call coll.stampall("thisField",replaceValue)
end if

call view.refresh
'the clear the document values so the user doesn't keep trying to redo the same ones..

-----------
ON the dialog box, and you can't really make it a dialog box, because you're calling it from a view.  So, you would have to be sure that there is a document selected and that the dialog box doesn't write to the selected document.  Or just call a regular form and set the saveOptions to "0" so it can never be saved. (better, BTW)
--

You can also step through each document in the view and flash the value in one field, and in the other field ask the user to input another value.   Any number of ways to approach this.

I tend to have a massive update form on my more complicated applications where users can globally change bunches of things.

YOu can even do this in formula  language, too.
0
 
TheBull369Author Commented:
what is the best way to go about it with a massive update form?? Is there a way to take this view and create a massive input form?? Like I said I am not sure how many rows of data there will be... Here is an example of what we have

Item   Quantity on Hand
Baseball       ____  The quantity on hand is where the user puts in a value for each item
Basketball    _____
Soccerball   ______  

The list could be 50 items long or it could be over 200 items long
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
TheBull369Author Commented:
what part of notes has 64k limit?
0
 
marilyngCommented:
My massive updates tend to do global things:

Increase all amounts by 5%, markup to 10%.
Generally, it's a table that has all the global buttons in a row with descriptions of what each does.  
Each button opens a dialog box where they can enter stuff and do the global updates.
I'm not sure stepping through the view is any faster in a dialog box than in the view itself.. especially since we now have the ability to do in view editing.

So, this particular function is called:  Update Quantities

The dialog box would count the number of items in the view when the dialog opens

Three fields:  Item
                    Current Quantity          Change Quantity
 

                               Previous and Next Buttons
                              Item #_ of Total Items counter_

The logic is something like
when the dialog box opens, count the view entries
do the doc = view.getnthEntry

Open that document in the dialog.
When then Prev or Next button is pressed
-see if the change = current, if not, change and save the document
-see if there is an entry in the button direction
-if so, move to that entry, if not "Message- end of line.."

-----
You can also trigger the changed field to update on exit and move to the next item in the view.

then you can add a markup all quantities by ___ % or each.
-------------
You can also do a tools\adjust quantities on selected, and let the user select bunches of items to change the quantities.
------

Generally, with quantities on hand and merchandise, someone is expected to step through and update each.  There is a kind of copy-machine that you add because they do a lot of repetition on item descriptions and minor entries.  Then there is a global markup on price and discounts, but the quantity on hand.. hard to globally set that.  You either have 10 items, or not. :)



0
 
TheBull369Author Commented:
Do you have a code sample of how the dialog function would work with the next and prev?? that might work if there was a next and prev capability to it and if it automatically saved the change when they click next...

I originally thought about doing it through in view editing but if the user doesnt click just right it wont go into edit mode. These users arent the greatest with a computer...
0
 
Sjef BosmanGroupware ConsultantCommented:
No streamline suggestions, just suggestion to be cautious: think carefully what happens when documents are added to or removed from the view while the user is editing them.

My approach would be (for relatively small numbers of documents):
- create a temp. NotesDocument
- get the ID and other info from those documents, and put it in multi-value fields on that temp. document
- use a DialogBox to present that temp document
- have buttons Add, Remove, Next, Previous to go through individual "record"
- if you need something fast, then add a field before and a field after the data entry field; when the users types the arrow-down key, the Entering-event of the next field can trigger the next record to be fetched

A set of functions can be found in the Sandbox:
    http://www-10.lotus.com/ldd/sandbox.nsf/ecc552f1ab6e46e4852568a90055c4cd/f2acda4419a5e3cd00256c0e00314e05?OpenDocument
0
 
marilyngCommented:
Yeah, my suggestions already do ALL that.  Surprised!! you usually post when you have something NEW to add.  

BTW that R5 tablewalker is really not all that good a solution.
0
 
Sjef BosmanGroupware ConsultantCommented:
I must be getting old... They do all that?? Do they read all data into ONE document? Where's the Entering-event? Can't find them.

There is a different tablewalker, by Andre Guirard I think. Can't find it though. And I have one...
0
 
marilyngCommented:
Yeah, the dialog box opens with the first document, then each next and prev just grabs the next doc in the view information into the dialog box, if it changes, then it looks up the docID and saves to the real document, else prev/next steps through the view.

Since it's a dialog box, it has to grab the first entry that is highighted or selected, the postopen just moves it to the first document in the view.

After that, it just reads data into the temp dialog box.  duh..
0
 
Sjef BosmanGroupware ConsultantCommented:
Instead of stepping through the view, I read it all in. And where is Add? Or Remove? Ah no, there's still some functionality to think about in your solution.
0
 
marilyngCommented:
No add or remove, just change, and no indication of how many items in the view.  Can be ten can be a thousand.  You're wrong.
0
 
Sjef BosmanGroupware ConsultantCommented:
Ah, we agree again... Let's quit the quarrel, and let TheBull select a solution, so we can continue from there.
0
 
marilyngCommented:
Ok, if you read the entire view into a temp document - docID's, then what? Post in another "view"  

You are welcome to post your solution.  I did this last night in a few hours, tested.
0
 
Sjef BosmanGroupware ConsultantCommented:
I usually don't post detailed solutions, you can find the outline above :)

The temp document is used by the DialogBox, and all buttons operate on the internal multi-value fields. Very fast. It depends on the number of documents in the view whether it is a feasible solution.
0
 
marilyngCommented:
Very disappointed that yours is a synopsis of my very detailed response, and that you still want to be considered for collect points.  Foul, Fowl, sir!
0
 
Sjef BosmanGroupware ConsultantCommented:
TheBull, no points for me please here!
0
 
TheBull369Author Commented:
Thanks Marilyn... That is what I was looking for....
0
 
marilyngCommented:
You are welcome.  I enjoyed the challenge.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.