Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Limit on # of Fields 1

Status
Not open for further replies.

LWB

Technical User
Feb 4, 2003
95
US
Can anyone tell me the maximum number of fields a table can contain? I don't mean records, but fields.

I'm trying to figure out how to display some data with very specific formatting requirements and the easiest way may be to stick it all (for display purposes only) into one table (of only one record but many fields).

Lynn
 
Lynn,

If I recall correctly it was 255 fields per table and I hope you never come close to reaching that limit. When thinking of databases I always try to think of tall and thin not short and wide, lots of records and few fields not lots of fields and few records. Have you tried to create a table with 2 fields to do the same thing? Field 1 "Data Name" Field 2 "Data" or something like that.

Hope this helps
Perrin
 
LWB,

The physical limit is 255 fields, however, you may run into a different limit if you are trying to create a Paradox 4 (or 3.5) table with several wide alphanumeric fields.

Specifically, the older Paradox format limited record sizes to 1,350 characters for keyed tables and 4,000 characters for unkeyed tables.

Thus you can't create a keyed Paradox 4 (or 3.5) table containing more than five A255 fields.

You can do this with Paradox 5 and 7 tables, however, I would reconsider trying to do so. I've seen very few cases where you really need that many A255 fields. (Granted, it was somewhat necessary before Memo fields were added to the Paradox format, but that's ancient history by now. ;-))

For other limits regarding the Paradox table format, please see:

-- --
Hope this helps...

-- Lance
 
Perrin,

Thanks for the info. I have thought about the method you mention (table with two fields, Name and Data), but I can't figure out how to format my form (or report). For example, I want the first value in the Data column to be located 6 inches from the top of the page at the left margin. The second value in the Data field needs to be 3 inches from the top and indented 0.5 inches, and the third value to be 9 inches from the top and indented 0.5 inches, and etc, etc. I actually have 513 records to place and I have to place each of them in a particular spot. In appearance they will be in colums where each column doubles in the number of values (ie 256 in the last column).

Can you tell me how to do this with each value being a record in one table?

Then to make things worse, I want to be able to do what I asked about in a previous post (and works great as I'm currently using it) and color any duplicate values in the form.

Lynn
 
Lynn,

You lost me here, I'm not getting the pattern or is there one? What defines where the field will be located.

Keep in mind you don't need to use actual fields in a form, you can have your fields placed where you need them and assign them as calculated fields and assign values to them through variables or an array. eg: read the table into an array and display it in calculated fields.

I'm sure you can get this to work you just might have to take an unconventional approach.

Perrin
 
Perrin,

Now you have lost me!

Currently the data I want to use has been "computed" from the other tables and stored in a table with fields named Gen1, Gen2, Gen3, Gen4, etc. It is not a normal table in that there is 1 value (alpha-numeric) in Gen1 (one non-blank value that is), 2 values in Gen2, 4 values in Gen3, 8 values in Gen4, 16 values in Gen5, 32 values in Gen6, 64 values in Gen7, 128 values in Gen7.

I want a form / report with the data shown in columns, the first column as 1 value, the second 2, the third 4, etc. Like this:

Gen3(1)
Gen2(1)
Gen3(2)
Gen1(1)
Gen3(3)
Gen2(2)
Gen3(4)

and etc.

I know about calculated fields, but I have no idea how to use them to put the data into this format. I think I may be missing the obvious here!

Lynn




 
Lyn,

This is a tough one to conceptualize but I'm sure it's doable. Are you attempting to do this in one large form or report, 128 fields long? Is the number of fields and values always consistant?

I don't have an easy solution yet but I'll keep thinking about it.

Perrin
 
Lynnn,

If I've got this correct you have a table with 7 fields Gen1-Gen7 and the table has 128 records. One non blank record for Gen1, two for Gen2, 4 for Gen3 ...128 for Gen7.

I'm not sure if it's the best approach, I keep going back to using calculated fields and it seems to work fine. I created a form with 7 arrays and put calculated fields on it as you described, column one uses an array g1[1], column two has two fields using an array g2[1] and g2[2], column 3 uses 4 fields arrays g3[1], g3[2] etc. I set up a test form going up to 4 columns and 4 fields.

In the forms open event I did a scan and created an array for each field containing the non blank values.

Var
G1, G2, G3, G4, G5, G6, G7 array[] anytype
tc tcursor
endVar

tc.open("test")
scan tc:
if tc.gen1.isblank() = false then
g1.addLast(tc.gen1)
endif
if tc.gen2.isblank() = false then
g2.addLast(tc.gen2)
endif
if tc.gen3.isblank() = false then
g3.addLast(tc.gen3)
endif
if tc.gen4.isblank() = false then
g4.addLast(tc.gen4)
endif
endscan
tc.close()

When the form opens all the fields contain the values from the corresponding array. I'm still not crazy about this approach but it does work and may work for you or give you some ideas for another approach.

Perrin
 
Lynn,

I'm a bit late on the conversation, but it seems you're looking for a way to indent field values on a report, based on some environmental factor. Is this correct?

If so, try this:

1. Add a SmallInt field to your table called Offset.

2. Populate the field with a value indicating the amount of indenting you want for that record

3. Create a new report using a single record style. (FWIW, I set the Field Layout to By Rows and unchecked Label Fields.)

4. Select the first field in your row, right-click it, and then choose Define field.

5. Place a checkmark in Calculated Field and then click Copy Field. This places a reference to the current field into the calculation.

6. Use the keyboard to change the calculation to something along these lines:

Code:
   space( [tabtest.Offset] * 3 ) + [tabtest.Label]

where tabTest is the name of your table in the data model. When finished, choose OK.

7. Widen your field object to make room for the indenting, set its Text | Alignment property to Left Aligned, and change its Design | Size to Fit property to FALSE.

8. Preview your report.

When done correctly, you should get something along the lines of what you're after. It's crude, but with the appropriate formatting (and Font), it can be effective.

Hope this helps...

-- Lance

P.S. The "trick" to using calculated fields well is remembering that you can use nearly any ObjectPAL function that returns a value that can be expressed as a string, such as the space() function.
 
Perrin,

We are getting close - I think!

I tried your code, it works great. I can use view() to see that the arrays have been filled with the correct values.

However, I can't figure out how to use the calculated field to display the values. When a put a field object on the form and under Define Field, I click on the calculated field box and put g1[1]it gives me an error about expecting an array (I forgot the exact wording). Is this the right approach? If so, what is the correct syntax?

Lynn
 
Lance,

That's not quite what I wanted to do. I already have some code that will produce a text file with with correct indenting - its not as elegant as your approach however.

If I add varying amounts of indenting to the fields themselves I will not be able to compare the values as easily (to color the matches).

Lynn
 
Lynn,

Yes that's the right approach, the problem is that the field can't see the array. You need to be sure to assign the array in the var section of methods at the form level so it is global to all objects. Then depending on where you put the code you may also need to add #formdata1.forceRefresh() after the code to update the field. If you add the code to a button or anywhere other than the open method you will need it.

Keep me posted, if you're still having trouble getting it to work let me know and I'll post the test code I did.

Perrin
 
Perrin,

I added the Var statements at the form level. That got rid of the error I had before. The code to fill the arrays is in the open statement (at the page level). However, now when I run the form the field fills with <error>. I put G1[1] into the calculated field and I have verified that the correct data is in the array.

Any ideas?

Lynn
 
Lynn,

You are so close, the <error> is normal if the array has not been assigned so I think the problem is still somewhere in where the code is executing. Below is the code I am using and it's working.

method open(var eventInfo Event)
if eventInfo.isPreFilter() then
;// This code executes for each object on the form
else
;// This code executes only for the form
tc.open(&quot;test&quot;)
scan tc:
if tc.gen1.isblank() = false then
g1.addLast(tc.gen1)
endif
if tc.gen2.isblank() = false then
g2.addLast(tc.gen2)
endif
if tc.gen3.isblank() = false then
g3.addLast(tc.gen3)
endif
if tc.gen4.isblank() = false then
g4.addLast(tc.gen4)
endif
if tc.gen5.isblank() = false then
g5.addLast(tc.gen5)
endif
endscan
tc.close()
endif
endMethod

Keep me posted.
Perrin
 
Perrin,

I'm using the same code (except for table name). And I have moved it from the page level to the form level (still got the <error>). I have added some g1.view(), g2.view(), etc statements after the tc.close() statement and the arrays all have the correct data in them.

I don't have the &quot;#formdata1.forceRefresh()&quot; statement you mentioned above, but that shouldn't be necessary with the code on the open statement.

Lynn
 
Lynn,

I posted my test form and table online at perrin.lacis.com/paradox just right click and select &quot;save as&quot; and save the files to a local directory. We must be missing something simple here.

Perrin
 
Perrin,

I won't be able to try your posted form until much later today. This computer does not have Paradox on it, and the nearby computer with Paradox does not have internet access.

I notice that although there is a formula in the calculate box (in Define Field) it still calls it &quot;undefined&quot;. Is this what it is supposed to do? On the form, the variable box does say &quot;formula&quot;.

Thanks for all your help. I'm sure we will figure it out eventually!

Lynn
 
Lynn,

The field sounds correct, a calculated field is by it's nature &quot;undefined&quot;, let me know how it works out.

P.S. the form and table is small you could always &quot;sneaker net&quot; it (flopy disk)

Perrin
 
Perrin,

I downloaded the fsl and the db files, but when I tried to run it I got a &quot;Table may be corrupted&quot; (not sure of exact words) error. The Table seemed okay, but I created another, borrowing the structure and copied the data into it. I got the same error. When I try to open the form in the design mode, it opens, but when I try to look at the code I get the same error.

When I run the form, the error message has an okay box and when I click on it, another identical error message appears. After closing a large number of these messages (20-30 I suppose) suddenly data appears on the form, but the error message is still there. After another 20 to 30 error messages I finally give up and use task manager to get me out of what seems to be an endless loop.

I was using Paradox 8 (I have 7 and 10 on the same computer) if that makes any difference. So far I have never had any trouble moving between various versions of Paradox. I should have tried Paradox 10, just to make sure.

On the good side, it appears to be exactly what I want to do!

Any ideas?

Lynn
 
Lynn,

I just love these simple tasks that are nothing but problems, I downloaded the form and table and have no problem running the form. I'm using Paradox 10, but I can't think of a reason that the form wouldn't run under 8.

I'm glad this what your looking for so lets keep at it, I still think you're missing somethin simple. How about trying the code on a button instead of the open method, be sure and add the &quot;#formdata1.forceRefresh()&quot; after the code if it's on a button.

Perrin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top