Link to home
Start Free TrialLog in
Avatar of Leepingtang
Leepingtang

asked on

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.

https://www.experts-exchange.com/questions/11538338/Relational-type-Documents.html?query=export+multiple+fields+as+seperate+entries&topics=133

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.

Avatar of marilyng
marilyng

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:
https://www.experts-exchange.com/questions/21894688/Dialog-Box-to-enter-new-students-to-one-field.html
https://www.experts-exchange.com/questions/21894965/Create-Custom-Data-Entry-Form-Dialog.html
Regards!
Avatar of Leepingtang

ASKER

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>

https://www.experts-exchange.com/questions/11538338/Relational-type-Documents.html?query=export+multiple+fields+as+seperate+entries&topics=133
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?
Ok, it worked now.
But...
leepingtang,

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:

one||1a||1b||1c||1d
two||2a||2b||2v||2d

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.

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.

http://img254.imageshack.us/my.php?image=tsleepingtang9ff.jpg

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.

ASKER CERTIFIED SOLUTION
Avatar of marilyng
marilyng

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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. :)