• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 284
  • Last Modified:

Create new documents from multiple fields

Dear all experts,
i am currently trying to build a timesheet for my org.
All time favourite, I have multiple row of similar fields which i would like to seperate them different entries.
I am aware that you can actually display them as multiple entries on the same row and export it to excel.
However, i would not like to go that path.
I found a PAQ as below from Snocross, that is to create seperate entries in another form for each rows at an event ( exit form, button click ) or by schedule.


But not sure how this actually works...

The current structure of my form now.

Date of timesheet: ######
Week Number: ( week number of year )
Staff Name: ########
Timesheet Status: ######
Approved by: #######

| No. | Project                               |    Activity         |    Day 1   | Day 2 ...     |  Total Time Spent    |
| 1     |  NSCPT                |  Development  |    2 Hrs    |   2 Hrs      | 4hrs                         |  
| 2     |  CRE Request sys                |   Development |    2 Hrs    |    1.5 Hrs |   3.5hrs                     |
                        Total      |     4hrs    |    3.5 Hrs|     7.5hrs                   |

At a button click, i would like to create seperate entries for each row if they are data in it.
with the following detail.

project name, activity name, name of staff, total time spent, weeknumber + year

Please assist.

  • 6
  • 4
1 Solution
Hi Leepingtang,

sjef provides links to a sample database that does this in sandbox. It's called tablewalker.

See these two answers for some similar solutions:
LeepingtangAuthor Commented:
Thanks for the link marilyn but it is not exactly what i am after.
Basically i want to be able to slice and dice the data from each row, say the activity name with it's respective details.
Using the table walker was my other choice before but it will not show the multiple rows on the same form as seperate entries unless it is exported to an excel document.
Am wondering if it's possible to do a click that will actually pulls the value and populate the values of each row as one new document in another form as what Snocross has answered in one of the archived PAQ>

LeepingtangAuthor Commented:
Sub Initialize
      Dim workspace As New NotesUIWorkspace
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim uidoc As NotesUIDocument
      Dim doc As NotesDocument
      Set db = session.CurrentDatabase
      Set uidoc = workspace.CurrentDocument    
      Set doc = New NotesDocument( db )
      doc.Form = "F-Activity"
      doc.ts_author = uidoc.FieldGetText( "ts_author" )
      doc.project_activity = uidoc.FieldGetText( "project_activity" )
      Call doc.Save( False, True )
End Sub

Still didnt work...whats the problem?
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

LeepingtangAuthor Commented:
Ok, it worked now.
LeepingtangAuthor Commented:

I'm not understanding how your data is stored.

Usually when I want to create an array of values that I need to manipulate I do this in a field or two
multi value, separate entries with new lines, and then separate each array with  "|" or "||"

So, I would have a hidden field with my array:


Like table walker, I just display the array results in a table.  But if I need to grab a value from the array, not a problem.

LeepingtangAuthor Commented:
Thanks Marilyn. One of the requirement that the management want is to produce report using the views.
If i have the data in arrays, the best i can display them is to use a columm that shows multivalue as seperate entries, well unless i exoprt it to excel or something.
The problem is, the reports that i can produce are very restricted.

I want to be able to produce a seperate record for each line / row so i can play around with the data and produce more constructive reports within LN itself.

I have succedded in creating multiple records for each row of fields on a button click. My question is... Is it a good approach to handling such problem?

My timesheet at the moment consist a fixed number of rows with fields.


I am currently using a For and Next statement to go through the fields and pick up values for each day if the first columm is not empty.

Ah,  I would probably have created a timesheet for each day, and then displayed these in a categorized view on the form.

But next is to create by week, and display the month in a categorized view.  

When you do by week, you have to decide if the week starts on Sunday or Monday, and can't change the week if you need to report it differently or if the rules change.

Collecting it your way isn't bad, you just have to check to see if the record exists before you create a duplicate.

The only thing I do (if I have to collect it this way) is to create my multivalue fields to display in views on the forms.

So I can stack all the mondays in one field, tuesdays in another and so on.

See what you have to remember is that Notes is not a spreadsheet.  If you were doing a spreadsheet timesheet, it would create a week per worksheet.  And as long as you knew where the cells were, you could create reports from those worksheets.   Most people try to do slam a worksheet into Notes, and then are surprized when it doesn't produce the report.   You treat notes like a database, and collect by day, you can display on the form any relative weeks, or months, but then you can also create very nice reports.

If you can't collect by the day and have to collect by the week, then one form should = one week, not a month.

Again, you design your database according to the reports or the questions you want answered.  So you always start with the reports.  If your reports say you have to manipulate data by the week, then collect by the week, and so on.
But that's my opinion :)
LeepingtangAuthor Commented:
Yes marilyn, this is actually my second attempt to create a productivity application.
My very first approach was using the one record per form method as you mentioned. ( one task, one day, one entry)
But complaints i heard was it's less user friendly than the timesheet interface. So i guess i will just stick to using LS to create new records based on the fields and perhaps beautify it a bit by creating buttons for adding rows ( hidding rows, i suppose ). Oh lord, Lotus Lotus...Thanks for your help again Marilyn, girls bravo!
Ah, that's the second requirement for database development: what are the users used to seeing?   So, this way, yes, you pretty much have to do all the logic in script and hidden fields at the bottom of the form.  :)

My other way of doing this is to show them three forms.. two that I really don't want them to use, and so make them miserably difficult to use, and the one I want to use.  This way they choose the form, and can't say they don't like it. :)
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.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now