Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Creating dynamic checkboxes

Posted on 2006-06-30
16
507 Views
Last Modified: 2013-12-18
Good evening all,

I am collecting information from a categorized view by manager name which lists the folks that report to that manager. Each manager has a different number of people working for them.  I'd like to show the information from that view in a form that has the manager's name at the top, of course, and then the people that report to him, each on their name on a line with a few checkboxes to the right of their name. How can I do this especially since the number of people would be dynamic. For example:

Manager:  Joe Something

Reports:

                                  Class 1              Class2               Class3            
     Jane Someone        chkbox here       chkbox here       chkbox here
     Bob So & so           chkbox here       chkbox here       chkbox here
     etc.

It'll give the manager a place to note whether or not a class was taken. Being able to include the date the class was taken would be a bonus (either below or to the right of the checkbox). I believe that I will need to deal with arrays, redim preserves, etc. I've been trying to figure out how to do it and have been able only to get a checkbox next to the name of the reports and having only the one column. Creating tables rows and fields as needed? Profile documents? My brain is going around and around. Can it even be done? What am I missing? Argh! I just thought of something ... there may be a different number of classes each year. Let's just deal with that dimension later. Let's just assume 3 classes for now. Thank you for your suggestions and help.

I am, as ever, in learning awe - Notes Rookie (on R6.5)
0
Comment
Question by:notesrookie
  • 7
  • 5
  • 4
16 Comments
 
LVL 18

Expert Comment

by:marilyng
ID: 17023711
Why not embed the view in the form?  You can create a table with one row, two columns and embed the view in one column, categorized according to Manager, and the second column can provide an explanation of what the list provides.

The columns for Class 1, Class 2, Class3 can be icons: @if(Class1<>"";168;0).  And if you don't want the manager to be able to open the document, put a bit of code in the queryopen view event.

-----------------------------
Second suggestion is coming up.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 17023726
Halfway describing the problem you head off into a solution again... That's also the reason why your head starts spinning. Let's get it fixed.

> I'd like to show the information ...
What information? Please don't make us guess.

> I believe ...
That's good :) But not very useful when it comes to programming. ;)


What you need is a standard approach for all problems you have to solve. It's an old method, but usually infallible: Describe, Analyse, Design, Develop, Implement (DADDI). The Description you gave is incomplete, so you my have to work on that. To Analyse, I'd like to have an ERD: Entity Relationship Diagram. In words will do. Otherwise, something like this:

Manager  1-->n  Employee  1-->n  Class ??

Or:
- one manager has n employees (n>=0)
- one employee did n classes

Now, you immediately see that you have a problem when you put only 3 classes in a form of a manager. Other issues:
- what is a class?
- does a class have properties?
- wouldn't it be better to put class attendance in a separate document, with class_started, class_ended, grade, result, etc??
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 17023729
Third suggestion is coming up... ;)
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 18

Expert Comment

by:marilyng
ID: 17024078
Here is another creative way to show those check marks dynamically...
      Create two image resources:  chk_no.gif, chk_yes.gif  (box with check in it, box with "x" in it)

      You have your employee class form with the class1, class2, class3 values.  At the bottom of this form you insert a parsedfield that will combine the values into a single line.
            This parsedweb field concatenates an "<img src=" tag with a chk_no or chk_yes image for the employee:
                             (employeename|<img src="YES image">|<img src="No image">|<img src="YES image">|  and so on)

      Then create a lookup view with two columns, the first is the manager's name, categorized.
      The second contains the parsedweb field

      Then you have your report form.  This is a form set with saveOptions = "0" so it can't be saved.
            The first field you select a manager's name from a dbcolumn lookup to your lookup view
                        A hidden field collects all the parsedweb employees in column#2 via a dblookup and puts those values in a hidden, multivalue field.
            A table on the form displays the results, using the images as the checked values.

Caveats:  64K dblookup value
        32K field limit value in the return field.
---------------------------------------------------------------------------------------------
The Employee Form:

 I used the fields you posted:
Manager
Employee
Class1
Class2
Class3

At the bottom of this form I put a parsed field:
Field:  parsedweb
Datatype:      Text
Help Description:      [Not Assigned]
Field Type:      Computed
Sign When Mailing/In Section:      No
Encryption:      Disabled
Update Requires Editor Access:      No
Formula:      
WEBNO := "<img src=\"/" + @WebDbName + "/chk_no.gif?OpenImageResource\" width=\"14\" height=\"13\" alt=\"No\"><BR>";
WEBYES := "<img src=\"/" + @WebDbName + "/chk_yes.gif?OpenImageResource\" width=\"14\" height=\"13\" alt=\"Yes\"><BR>";
FullList := Class1 : Class2 : Class3 + "|";
x := "|" + @Right("~" + FullList; "~|");
ClassList := @ReplaceSubstring(@Implode(@Replace(@Replace(FullList; x; "CHKNO|"); "1|"; "CHKYES|")); " "; "");
WebList := @ReplaceSubstring(@ReplaceSubstring(ClassList; "CHKNO"; WEBNO); "CHKYES"; WEBYES);
Employee + "|" + WebList;

-chk_no.gif was an image resource:  box with an "X" in it.
-chk_yes.gif is an image resource: box with a check in it.
-Class1,2,&3 were check boxes with "Yes|1" as the formula.  When you checked the field, the value returned is "1", else it is blank.

Note: <img src=\"/" + @WebDbName << is tested local, so there is a leading "/" so the webdbname points to my local test database

When you complete and save the form the parsed web field displays:
-----------------------
Mary Jones|<img src="/test%204.nsf/chk_no.gif?OpenImageResource" width="14" height="13" alt="No"><BR>|<img src="/test%204.nsf/chk_no.gif?OpenImageResource" width="14" height="13" alt="No"><BR>|<img src="/test%204.nsf/chk_yes.gif?OpenImageResource" width="14" height="13" alt="Yes"><BR>|;
-----------------------------------------
Now I have my lookup view:  
ViewName:      Rookie
Col1:            Manager, categorized
Col2:            parsedweb
-----------------------
Then I completed a display form:
Field:      SaveOptions, computed, formula="1"
Field:      Form, computed, hidden, "Rookie Display"

Field:      Manager, dialoglist, formula=@DbColumn("":"NoCache";"";"Rookie";1)

Button:      Show Class Results
      Script:
      Sub Click(Source As Button)
      Dim Session As New NotesSession
      Dim db As NotesDatabase
      Dim ws As New NotesUIWorkspace
      Dim uidoc As NotesUIDocument
      Set db = session.currentdatabase
      Dim doc As NotesDocument
      Set uidoc = ws.currentdocument
      Set doc = uidoc.document
      doc.display = doc.classlist
      uidoc.close
      Set uidoc = ws.editdocument(True, doc)
      Call uidoc.reload
            End Sub

Field:      ClassList,
      computed, multivalue text, separate entries with new line, hidden.
Formula:      
List:=@If(SelectManager="";"";@DbLookup("":"NoCache";"":"";"Rookie";SelectManager;2));
@If(@IsError(List)|List="";"";List)
----------------------------------------------------------------------------------------
Then I created a table with two rows, four columns
First Row:      
      Titles - Employee Name, Class1, Class2, Class3
Second Row:      
Column1: (Employee Name)
      ComputedText - Passthrough HTML
      Formula:
      N1:="<font size=\"2\" face=\"arial\" color=\"#000000\">" + @Word(ClassList;"|";1) ;
      N2:=N1 +"</font><BR>";
      @Implode(N2;@newLine)
            
Column2:(Class1)
      Computed Text - Passthrough HTML
      Formula:
      @Implode(@Word(classList;"|";2);@NewLine)

Column3:(Class2)
      Computed Text - Passthrough HTML
      Formula:
      @Implode(@Word(classList;"|";3);@NewLine)

Column4:(Class3)
      Computed Text - Passthrough HTML
      Formula:
      @Implode(@Word(classList;"|";4);@NewLine)

---------------
You would have to add a bit of formatting, and in order for the computedtext to display, you have to reload the form, both in client and in web.  But, you can have the manager's field automatically select the current user, and it will flash correctly for notes web and client.
0
 
LVL 18

Expert Comment

by:marilyng
ID: 17024082
Hey, sjef.. this one was fun... see if you can add to it..   Also, used a bit of your parsing formula :)
0
 
LVL 18

Expert Comment

by:marilyng
ID: 17024088
Ah, forgot to mention, the computedTExt only flashes when you reload the document, which is why I put a button with a click formula.  For web, you need to adjust to reload the document.
0
 

Author Comment

by:notesrookie
ID: 17025515
Wow - lots of information to digest. In order to elaborate, the categorized view that I am collecting the information from is a manager view with his subordinates listed. I'd like to create a form that enables each of these managers to have a document where the manager can click on checkboxes as to whether or not each of their subordinates have taken a required training class. These checkboxes would solely exist because they would appear calculated on the basis of the existence of an employee. Currently there is no class form that has the information that a student attended and when it was held (no grades luckily - phew!). I'll be digesting and testing and I'll get back to you.

Please let me know if I can supply you with more information. Thank you.

0
 

Author Comment

by:notesrookie
ID: 17025567
I apologize if my initial description was confusing. All the manager wants to do is to be able to have a quick visual in this form as to whether or not his suboridinates hava taken a class. Instead of printing out a bunch of emails and having to constantly refer to them in individual folders, he/she can check off the class in this "dynamic" (because there are many managers with a different number of employees) form. I'm sorry if I led you astray.
0
 

Author Comment

by:notesrookie
ID: 17025576
So there is no corresponding form for the class, just 2 forms. Form1 has the managers and subordinates names and Form2 has the manager'name, current year and the classes that need to be taken. Does this make more sense?
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 17026346
> All the manager wants to do ...
Yeah, sure, we've heard that before. And then they want you to add the date they did the class, which means you're up to your pretty neck in trouble. And then they say: can you give me an overview of all people who attended that class??

Gouverner, c'est prévoir...

0
 
LVL 18

Accepted Solution

by:
marilyng earned 500 total points
ID: 17026502
where the manager can click on checkboxes <<  Then you'd pretty much have to do an embedded view with column editing in place.

My second suggestion was a way to show a list of who took the class.  However, you could add an "onclick" event to each of the yes/no check boxes and make it change the underlying value, but it's going to be clutsy..

    Check the image, onclick event finds the class form, changes the value and then the displayed form has to reload.

You can add a link to the employee record on the display form, and let it open the actual record to change.

---------------------
But if they're going to change the class or click off the class, then embed the view and select the manager's name as the category.  

sjef, I haven't tried editing columns in an embedded view.. have you?
0
 
LVL 18

Expert Comment

by:marilyng
ID: 17026518
hee, hee... if you can't use edit columns in the embedded view, then you'd have to use... silence, suspense..

EMBEDDED EDITOR!

----------------
Embedded view with embedded editor (and it doesn't have to be the real form, it can be a different, check-only-the-class-box form)

So you can create a form that either collects the manager's name when it opens and shows the correct category in the embedded view, or have a dialog box that will allow you to select the manager's name and a list of employees in the categorized view.
    -- for this one, I have a default, blank view that has one form listed: Please select a manager's name!

When they select a manager's name, the computed view loads to the manager's name category and displays the list of employees.

If you can't use the column editing feature in an embedded view, then when they click on a document in the view, it can appear in an embedded editor. Else, they can click and open the document to edit it.

0
 

Author Comment

by:notesrookie
ID: 17028240
sjef - Yes, they tend to start of that way, "they just want to" and then the additional requirements come in they wonder why you can't turn it around in less than a day.

marilyng - Embedded editor ... hmmmm. Haven't used that one yet. It should be interesting.

Let me check it out and I'll get back to you. Thanks for pointing it out to me.
0
 

Author Comment

by:notesrookie
ID: 17053799
Hah! They did come back with more just as you predicted, sjef. But I was able to use marilyng's solution to implement what they wanted. I used an embedded view with single category in a form, set the class columns as editable and used the inviewedit event to allow changes to be made from the view and so they can be made from the embedded view as well. But instead of checkmarks, there is a validation formula in the inviewedit event to check for "Y" or "N". So the managers can now look at the form for a quick visual or open each subordinates document to look at class attendance. Sheesh! Why is it that when they want something really simple it tends to be more complicated than anything you've ever done and when they make it more complicated that it sometimes simplifies things?

At any rate, thank you again for the great suggestions and ideas!
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 17054038
Your hobbyhorse wins again, Marilyn!  
0
 
LVL 18

Expert Comment

by:marilyng
ID: 17057453
You know what happens, your solution sparks an idea - you see when they asked for something, they had a blank slate in their minds because they couldn't envision how it could be done.  When you provide a visual example, it sparks creativity and then they are reminded of something else they needed...

That's a good thing, BTW.  Keeps you working. :)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question