Jump to content

Viewing results of a check box horizontally


technoranger

This topic is 8252 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I have a simple database withseveral fields that are checkboxes. I want to be able to view records in a table layout, but the results of the checkbox fields are displayed vertically - only the first selection shows and the rest are separated by hard returns. If I select the field, all entries show, buut I want to be able to print the table for people.

Is there a way to replace the hard returns with spaces or otherwise display the results in a horizontal field?

Link to comment
Share on other sites

  • 2 weeks later...

The list produced by a checkbox field is essentially a text file. To display its contents in a different format, you need to create a new text field, CheckboxHoriz. A script is used to fill it with the format you desire.

The script is simple, but repetitive. If you later add a new value list entry, you must remember to add it to the script.

[CheckboxVert is your current, columnar field, and is where the "real" data resides.]

Enter Find Mode

Set ( CheckboxVert = "List_Item_1" ) ** where List_Item_1 is the text next to the first checkbox

Perform Find

Loop

Set ( CheckboxHoriz = "List_Item_1, " & CheckboxHoriz ) ** "List_Item_1" is the text next to the first checkbox and the comma separator can be changed to be a certain number of spaces, a pipe, etc... but not a Paragraph mark, or you will be back where you started.

Go to Next Record (exit after last)

End Loop

# ** a blank comment to visually separate each List Item

Enter Find Mode

Set (CheckboxVert = "List_Item_2")

Perform Find

Loop

Set ( CheckboxHoriz = "List_Item_2, " & CheckboxHoriz )

Go to Next Record (exit after last)

End Loop

#

Enter Find Mode

Set (CheckboxVert = "List_Item_3")

Keep going until you have all your List Items loaded into the script.

After you run the script, your CheckboxVert field will look like "List_Item_1, List_Item_2,..."

Put the CheckboxVert field on your list view and make it non-editable, because it is actually a calculated field. If you leave it editable, someone [maybe even you smile.gif" border="0] _will_ change it someday, and think they have changed the underlying data, which is stored in CheckboxVert.

Link to comment
Share on other sites

Ooops! Forgot to initialize CheckboxHoriz!

Add to the top of the Script:

Show All Records

Replace ( no dialog , CheckboxHoriz, "" )

If you leave this off, the horizontal list will append itself to the last time you ran the script and will contain duplicates.

Link to comment
Share on other sites

Why not just create a calculation field that uses the Substitute() function to change all the carriage returns into spaces (or commas). Put this calculation field on your print layout.

No scripts required! I try do do without scripts as much a possible because they slow the database down, can prove troublesome or even break on multi-user mode (anything that uses the Replace command can fail because of record locking) and unless the script is performed at the right time the values won't be correct.

Link to comment
Share on other sites

I tried using Substitute ( ) to replace the carriage returns with space then tried with a comma. The result I got was a vertical list with spaces or commas after each entry. The returns were replaced with the substitute character, but the effect - a new line - was not removed. What seems to need to happen is replacing the carriage return with two characters - delete, then a space or comma. I can't figure out how to define a delete character into the function. If you have any idea, please let me know, that would be the easiest way to set this up. I'm going to try the script, but some of the lists I have contain 25 values.....

Thank both of you for your responses.

[ September 03, 2001: Message edited by: RangerRick ]

Link to comment
Share on other sites

The substitute function should work (I just tried it!). Make sure you have made the field large enough in the horizontal direction for all the entries to fit. A "delete" character wouldn't help, you are confusing a delete "character" (ASCII code) with a delete "operation", just placing as ASCII code in a field doesn't necessarily perform a delete.

How exactly did you set up the calculation field with the delete?

-bd

Link to comment
Share on other sites

This is the function I used. Accommodations is the text field with the check boxes, I enclosed a return in quotes, followed by comma then comma in quotes. Substitute(Accommodations, "

", ",")

What I get is:

1A

1C

2D

converted to

1A,

1C,

2D,

If you are achieving the right results, I am doing something wrong.

Point out the error of my ways.

Thanks,

Rick

Link to comment
Share on other sites

  • 2 weeks later...
  • Newbies

First, thank you so much, all of you. I was dying trying to find a solution to this problem. I'm sure the script idea will work but I'm still trying to get Substitute to work.

Below is a snippet of a calculation I'm trying to get to work. Basically, it's a conditional display of the value list TitleToiletKing uses based on how many entries there are. More specifically, if there are multiple entries I want them displayed horizontally, separated by a comma and a space.

Each line used to be identical to the last but I decided to show you the different combinations of functions I used and still couldn't get it to work. I'd love to figure out why none of these affect the output of the value list's values.

Thanks again!

& Case( TitleToiletKing > "", "Toilet King: " & GetRepetition( TitleToiletKing , 1),

Count( TitleToiletKing ) > 1, Substitute( LeftWords( TitleToiletKing , 2 ) , "

Link to comment
Share on other sites

  • Newbies

Hey!

Well, of course, I made a silly mistake. Instead of just using Substitute on the field I wanted the data from I used it to modify the modification of the field, i.e. instead of Substitute(FieldName... I used Substitute(Leftwords(FieldName....

Thanks for the help.

Link to comment
Share on other sites

  • 5 weeks later...

This topic is 8252 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.