Jump to content

Displaying 2 of 8 (Total 10) independently


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

Recommended Posts

Hi. My database (one file) has 3 types of records: Customers, Addresses, Cards. There is a field that differentiate the records by the type. Having this set up, how to display for example 2 of 8 (Total 10) independently for each record type? Thank you.

Version: v5.x

Platform: Windows 2000

Link to comment
Share on other sites

Vasilek->

I don't understand which records you want to display, please elaborate.

Do you want to display just records of one type (Customers, Addresses, Cards)?

Do you want to display certain records, regardless of their type? If so, what determines which records are displayed: do you search on fields? is their a single field to differentiate records?

Do you just want to sort the list by type and then some other info?

Sam

Link to comment
Share on other sites

If the database contains 10 Customers, then when the user clicks on a button that triggers 'Find Customers' script, he/she should see for example 1 of 10(Found) (10 Total Customers) displayed on the first found record, 2 of 10(Found) (10 Total Customers) displayed on the second found record... 10 of 10(Found) (10 Total Customers).

When the user will search for customers with last name Smith, he/she should see for example 1 of 3(Found) (10 Total Customers), cause we have 3 customers with the last name Smith. When the user will go to the next record in this found set - 2 of 3(Found) (10 Total Customers) will be displayed, next - 3 of 3 (Found) (10 Total Customers).

The result should be as with using CurrentFoundCount and CurrentRecordCount if there were only the records of one type, but I have records of 3 types -Customers, Addresses and Cards.

Does it make sense now?

Link to comment
Share on other sites

Vasilek->

First, display the X of Y found, Z Total Customers. Y and Z you already know (CurrentFoundCount and CurrentRecordCount). To display X in a Portal, you could use a text block with the record # symbol in it: @@. If you use Status(CurrentRecordNumber), be aware that this is the order they are in the found set in the related file, it won't work if you sort the portal. One way aorund this is to run a script that sorts in the order you want for the portal and then sets X using the script step Replace Contents specifying serial #s.

One tip: if I have a text field that I often check against using If( theField="Customer",...

I will make a number calculation field with the boolean theField="Customer". This can be used in relationships & other calculations more easily that typing the If over and over...

Did I answer the right question?

Link to comment
Share on other sites

Vasilek->

Part of my answer was wrong (I learned something today...). I said:

If you use Status(CurrentRecordNumber), be aware that this is the order they are in the found set in the related file, it won't work if you sort the portal.

Status(CurrentRecordNumber) will work if the calculation containing it is set to unstored so it will recalculate using the portal's sort order. In the calc's options, check "Do not store calculation results -- calculate only when needed" in the Storage Options dialog.

This works but is unnecessary:

One way around this is to run a script that sorts in the order you want for the portal and then sets X using the script step Replace Contents specifying serial #s.

Link to comment
Share on other sites

CyborgSam->

X, Y and Z (@@, CurrentFoundCount and CurrentRecordCount) are counting all of the records, including records of types Addresses and Cards. This is the problem here that I am trying to resolve here. I need Customers only, Addresses only and Cards only. All separate. All independent numbers. Is it possible if all of those records of different types are in one file? Thanks.

Link to comment
Share on other sites

Vasilek->

> Is it possible if all of those records of different types are in one file?

Your original post said they were all in one file, please explain what you mean here if my answer below doesn't help.

If you want just the Customers to display in a portal, or just the Addresses, or just the Cards:

1) Define a value list with "Customers", "Addresses", "Cards"

2) Define a global field g.DisplayWhat, put it on the portal layout and assign the value list to it as a popup menu/list.

3) Define a relationship between g.DisplayWhat and the field with the text "Customers", "Addresses", "Cards".

4) Set up the portal. When you change the popup menu the portal's display will change to just what the popup says.

Sam

Link to comment
Share on other sites

I am sorry for the confusion. Let me try again.

We have the database (1 file) with 3 types of records in it: 'Customers', 'Addresses', 'Cards'.

Let's assume that the search result returned 8 out of 10 Customers matching the search criteria.

We need to display on the layout for the current record we are looking at right now that we are, for example, on the 2nd record (or the 1st or the 5th) of the 8 found records of 10 total records of type 'Customers'.

Literally: 2 of 8 (Total 10).

Keep in mind, we have records of other types which will not be counted here.

We are not trying to display all the records here. To see the content of the records the user will scroll through them and while scrolling the 2 will become 3 then 4 then 5 then 6 then 7 then 8 of 8 (Total 10).

Thanks for your patience,

vasilek.

Link to comment
Share on other sites

Vasilek->

Literally: 2 of 8 (Total 10).

the 2: Status(CurrentRecordNumber) - keep this calculation unstored so it always works OK.

the 8: Status(CurrentFoundCount)

the 10: Status(CurrentRecordCount)

In one calculation:

NumToText(Status(CurrentRecordNumber)) & " of " & NumToText(Status(CurrentFoundCount)) & " (Total " & NumToText(Status(CurrentRecordCount)) & ")"

Is this the right answer?

Link to comment
Share on other sites

Just to try to make this more clear.

The database could have 30 records, but there is only 10 records of type "Customers", 15 records of type "Addresses" and 5 records of type "Cards".

With using just status functions mentioned above, the CurrentRecordCount will be 30, which is wrong in my case. It should be 10, 15 and 5 depending on what type of record I am at the moment.

The same logic applies for CurrentRecordNumber and CurrentFoundCount.

They should not be looking at the records in the entire database, but in one category only.

Hope this will not complicate things more. smile.gif

Link to comment
Share on other sites

Vasilek->

I think I fully understand what you want now. laugh.gif

It's a bit complex to explain, so I made an example database (FM5/FM6) for you to view (see attachment). The calcs, etc. are made simply so the logic is easy to follow. There are ways to optimize what I've done. Once you understand the methodology I'm sure you'll want to customize it more.

Version: v7.x

Platform: Mac OS X Panther

Vasilek.zip

Link to comment
Share on other sites

One minor tweak on your HeaderText, to make it a little more dynamic,

RecType & " #" &

Case(

RecType = "Customer", CustomerNum,

RecType = "Address", AddressNum,

RecType = "Card", CardNum

) & " of " &

Case(

RecType = "Customer", NumCustomers,

RecType = "Address", NumAddresses,

RecType = "Card", NumCards

) & " Found " & RecType &

can be replaced with

RecType & " #" &

GetField( RecType & "Num" )

& " of " &

GetField( "Num" & RecType & "s" )

& " Found " & RecType &

and if additional RecTypes are ever added, you only need create the extra fields (with the same name formatting) and add to your Case( ) test for plurals.

Link to comment
Share on other sites

Queue->

Good point. I was trying to keep the code self-explanatory & as simple as possible.

Vasilek: after you get the calculations working, try Queue's mods. Learn GetField's power, it is used in many fancy techniques like variable portal sorting.

Link to comment
Share on other sites

This topic is 6512 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
 Share

×
×
  • Create New...

Important Information

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