Page Index Toggle Pages: [1] 2  Send Topic Send Topic Print Print
Hot Topic (More than 10 Replies) Subform item selection (Read 3809 times)
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Subform item selection
May 21st, 2011 at 11:27pm
Print Post Print Post  
I have a database with subform where individual subform records represent a document. I print those documents out to make a pdf file as needed. However, I do not always need to printout all the documents in the subform.  It would be nice if I could include a Boolean check mark in the subform but that is not to be in Sesame at the present time. Is there anyway I can select only a few records in the subform to be printed?  Your help is always very much appreciated.









  
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Subform item selection
Reply #1 - May 22nd, 2011 at 5:54am
Print Post Print Post  
I am referring to tableview subform where you can see all the records. If I can only place a checkmark to the records needs to be included in printing!!!
  
Back to top
 
IP Logged
 
Rick_R
Full Member
***
Offline



Posts: 243
Joined: Jan 29th, 2010
Re: Subform item selection
Reply #2 - May 22nd, 2011 at 7:13am
Print Post Print Post  
Is there a reason you can't include a field in the database used only for that?  When you select a record, have the code for the main record either set or clear that field in every subrecord or set/clear it based on some algorithm (e.g., "clear the field where the record was created more than 90 days ago and set it on records less than 91 days old).

That's similar to the practice of creating a "temp", "misc" or "junk" field intended as a temporary scratch pad, e.g., when running Mass Update, it stores the original field value in the "temp" field before running the update.  If something goes wrong, you just replace the updated field with the data in the temp field.
  
Back to top
 
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Subform item selection
Reply #3 - May 23rd, 2011 at 1:07am
Print Post Print Post  
Bharat, I was also not in favor of adding an extra checkbox just for printing, so we use a command button to popup  asking the user which lines they want to print ( See PromptForUserInput() ). It then loops through the records (using FormFieldValue() ), printing the selected records as it goes.

We use this daily and it works well, but writing the program for it was a bit tedious. I'd be eager to see if anyone has an easier method.

Steve



  
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Subform item selection
Reply #4 - May 23rd, 2011 at 1:57am
Print Post Print Post  
Thanks Rick and Steve. Thanks for your input. I am still not sure what way to go. Say if there are 25 records to choose from and five records needs to be selected. Using PromptUserInput ( ) one will have to write the record (line) numbers.  Say I want to print 19 records out of 25, it will be tedious to do that. With PopUpMenu  ) and similar commands, one can only choose a single record.

There has to be an easier way!
  
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Subform item selection
Reply #5 - May 23rd, 2011 at 12:56pm
Print Post Print Post  
What we are looking for is the way to select multiple records. I believe, checkbox boolean field is the best way,  with mark all or unmark all to start with.  It is more visual as well as practical. Giving a real estate of just a check box space in subform is not a big deal.

Creating a separate text field to mark it with "x" or yes o no, will temporarily solve the problem and overcome the limitation but still the best is to be able to checkmark boolean field in the tableview subform. Just look at gmail interface (Google), they have checkmark box in front of individual emails and then dropdown list of properties to apply, such as "mark read", "apply label", "move", "delete", etc.

@PromptForUserInput ( ), if we have 50 records and selecting or inputting 30 of them by writing down each exactly in the little box makes it not so user friendly and error prone.
« Last Edit: May 23rd, 2011 at 2:15pm by Bharat_Naik »  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Subform item selection
Reply #6 - May 23rd, 2011 at 3:04pm
Print Post Print Post  
You can use an unbound field with a bit of programming in it to detect if the user has selected a particular row, then store that row's number (or ID or such) in a variable - array, string, or string array. If you wish, you can use the on draw event to draw a checkmark or whatever you prefer on that cell to indicate selection/deselection. Remove any elements from the array, if deselected. If you have more actions than print/not print, you can cause a popup selection menu to appear somewhere near the cell, allowing the user to add that row to one array (list) or another. On the parent form, provide command buttons that go through the list, performing the selected action.

If you think using variables instead of fields on a form, the possibilities are nearly endless.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Subform item selection
Reply #7 - May 23rd, 2011 at 3:19pm
Print Post Print Post  
Thanks Mark for your feedback. How do I draw checkmark on OnDraw event?  I will need time to digest what you have suggested. Thanks again.
  
Back to top
 
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Subform item selection
Reply #8 - May 23rd, 2011 at 3:59pm
Print Post Print Post  
Bharat,

I agree with you and Rick. My procedure works well when only a few sub-records exist, or when 'all' sub-records are usually printed.

Mark's suggestion is very intriguing. Looking forward to learning more about OnDraw events. (Lately, our users have been requesting command buttons on each line. Perhaps this will help to accomplish that.)

Steve
  
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Subform item selection
Reply #9 - May 23rd, 2011 at 4:06pm
Print Post Print Post  
Mark, I am still trying to understand the solution you have offered. The real problem for me that just as Subform does not display command buttons and combobox, it does not display checkbox. I cannot have unbound box as sometimes the printing is initiated from other forms and that require me to use @xResultSetSearch ( ) routine and loop to choose the records as printing involves other documents from elsewhere and it combine all of them in one pdf file.
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Subform item selection
Reply #10 - May 23rd, 2011 at 4:11pm
Print Post Print Post  
Bharat_Naik wrote on May 23rd, 2011 at 4:06pm:
I cannot have unbound box as sometimes the printing is initiated from other forms and that require me to use @xResultSetSearch ( ) routine and loop to choose the records as printing involves other documents from elsewhere and it combine all of them in one pdf file.


Have the unbound simply be used to select the row to print in the one instance. Have any other routines that do the print all call the same subroutine, filling in the list automatically (if user selection is not needed in that instance). That way all of the routines that do this call the same subroutine and you only have to maintain one bit of source.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Subform item selection
Reply #11 - May 23rd, 2011 at 4:38pm
Print Post Print Post  
Thanks Mark. That makes sense. What about Checkbox in subform? I am a little lost there.
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Subform item selection
Reply #12 - May 23rd, 2011 at 4:52pm
Print Post Print Post  
Bharat_Naik wrote on May 23rd, 2011 at 4:38pm:
Thanks Mark. That makes sense. What about Checkbox in subform? I am a little lost there.


A checkbox is simply a visual representation of a data, it is not the data itself. If you feel that having 1s and 0s or Xs and Os, isn't clear enough, you can use the On Draw event to draw the cell any way you want. Have the on draw event check the array. If that row is included, draw a check, if not - draw a filled blank. It is even possible to set the font for a column and draw an extended ascii (code page) check mark, by setting the font to one that includes a check mark (wingdings, for example). If you wish, you could even use a bound element and set the value to the ascii code.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Acebanner
Full Member
***
Offline



Posts: 123
Location: New York City
Joined: Jan 23rd, 2008
Re: Subform item selection
Reply #13 - May 23rd, 2011 at 8:47pm
Print Post Print Post  
Using Wingdings2 font on a text field @CHR(82) and @CHR(163) produce a nice-looking checked and unchecked box, respectively. Mark, can you give us a little sample code for the string that manages the selections? Would you use ClientLocalVariable to maintain the string? This would be a nice feature to have.
  
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Subform item selection
Reply #14 - May 24th, 2011 at 12:59pm
Print Post Print Post  
Acebanner wrote on May 23rd, 2011 at 8:47pm:
Using Wingdings2 font on a text field @CHR(82) and @CHR(163) produce a nice-looking checked and unchecked box, respectively. Mark, can you give us a little sample code for the string that manages the selections? Would you use ClientLocalVariable to maintain the string? This would be a nice feature to have.


Sorry, no sample, I have Sesame 3 work a-plenty. But, there is no need to use ClientLocalValue unless you want to pass the variable around from form to form, and even then I'd recommend that you only use the ClientLocalValue after the string is complete. A simple string, array, or string array will do the trick.

When the user clicks in the row (maybe in a field for that purpose), run through the string to see if that row's ID is already in the array/string, if not - add it and set the indicator field to true, if so - remove it and set the indicator to false. Provide a button on the parent that runs through the string/array and prints (or whatever) each of the table rows based on the listed IDs. Again, the key to this approach is using variables, since the selection does not need to retained. Unless data has to be retained, variables should be used - not fields or more elaborate storage.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send Topic Send Topic Print Print