Knowing which record I am viewing in the form view

Very new to Panorama.

I have a data sheet with 101 records.

I created a forum view. I then Undertook a search on the form view which found 23 records.

When I browse the found set in the form view, is there a way for me to know which of the found record am I viewing e.g. 12th record of the 23 found records.

Thank you and warm regards,
Naren

The info(“selected”) function shows the total number of selected records. Using your example above, the info(“selected”) function would show “23”.

To place this function on a form, select the form, then click menu item “Window → Switch to Graphics Mode”. This allows you to edit the form.

Next, grab the object “Text Display”, and drag it to the form.

Click your newly dragged Text Display object. Next, click the “Formula” tab in the object properties panel, as highlighted by the red box below.

In the Formula box, type in the following: “{info(“selected”)}”, as shown below.

As the image above shows, 20 records are currently selected.

Showing the number of the found record is tricky. As far as I know, there is no function that displays this number. Perhaps someone can jump in here and correct me.

As a not so elegant alternative, one could write a script to calculate this number. This could be accomplished through the following steps.

First, create a new field. Let’s call this new field “SelectNumber”.

Next, create a button on your form by dragging a button to the form, as the image below shows.

Next, click the newly dragged button, and click the “Procedure” tab, as highlighted in red below.

Type in the following in the Procedure box:

local iSearch

gettext “What is the search term?”,iSearch

select «Field XX» contains iSearch

field «SelectNumber»
sequence 1

Your form will now look like the image below.

Replace “Field XX” with the name of the field in which you wish to search.

Next, rename the button by clicking the “Push Button Options” tab, as highlighted by the red box below.

Type in “Search” for the Title (or whatever title you wish).

Next, click the Text Display object you initially created. Click the Formula tab, and type in the following.

Record {«SelectNumber»+" of "+info(“selected”)}

Now click “Data Mode”, as highlighted above by the red box.

The final result is shown below.

Not really. As @KerianMachines indicated, you can display the number of selected records, but there is no way to display the ordinal number of the current record within the selected set.

One thing you could do is use two windows - the form and the data sheet. Then you can easily see what record you are on.

Or, you can add a Text List object to your form that will display the currently selected records right in the form. In other words, build a version of the data sheet into the form. The primary help page for learning about this is:

@KerianMachines and @admin, Thank you for your helpful answers and workarounds. I will follow your tips.

Thank you and warm regards,
Naren

Naren17 - this might be a simpler approach. But first, you must understand what you are asking; or, I need to.

It sounds like you are asking for the “number” of the record you are looking at - out of the group of records you selected.

That implies the records are in some order - the 12th record is different from the 11th and the 13th. That order/position depends on how the records are sorted.

See how all this has to be thought out BEFORE you consider how to do it.

Here is a very simple way … Create a numeric integer field in your database called RecNum (it could be any name). Add the field to your form.

After your procedure (or manual action) that does the selection and possible sorting, you now have your candidate records in the desired order.

I’ll tell you what to do because I don’t know if you’ll be writing a procedure or doing the steps manually. PanX has a feature that will “record” your steps and write most of the procedure for you - but that’s a different topic.

Click in any RecNum field record
Under the menu Field hold the mouse on Morph and slide over to select “Fill with Formula”

Note - you can also right-click on the field name RecNum and reach Morph/Fill with Forumula from there.

In the Formula window put Seq() and click the “Fill” button

This will put an ascending sequence number in the RecNum field of each selected record.

If you now view those records, individually, on a form and the form has the field RecNum on it, you’ll see if you are looking at the first, second, third, etc. record of the ones you’ve selected (and maybe sorted).

But, as the Charmin commercials might say, “… the job’s not over until the paperwork is done.”

Once done with whatever task you are doing, you’ll want to “clean out” RecNum so it’s ready for the next time.

Make sure you are in the RecNum field
Go to “Fill with Formula” again (via Morph)
In the Formula box put “”
That’s two quotes with nothing between them.
Click the Fill button.
That will clean out (empty out) the RecNum field.

A simple procedure code for that is:

Field RecNum
FormulaFill “”

Note that it will only act on selected records.
Where and when you do that is up to your proclivities.

I don’t assume the condition of a database when I open it. In my initialize routine I put the database in a “known” condition by selecting/sorting to some state. For example, I might do

SelectAll
Field RecNum
Formulafill “”

RecNum is now cleared for all records.

If you don’t clear RecNum when you are finished with the task at hand, there’s a risk that you might view a record that has a remnant of your Seq() action remaining in RecNum and you’ll see a record number that is not representative of the current condition.

Thank you @designer for the detailed reply!

When I browser the 23 selected records, I want to know which one I am currently browsing (i.e. am I browsing the 12th of the 23 found records or, 13th of the 23 found records). [I am coming from FM]

I will work through your advice. Once I have done this, will let you know. It will take me some time.

Cheers!

I implemented a method that uses the unique number of each record which can be obtained with info("serverrecordid"). The method requires one formula in a text display object and a couple lines of code in the search button.

Create a button with the following code:

findselect
letfileglobal fgSelectedRecords=arrayselectedbuild(¶,"",{info("serverrecordid")})
showvariables fgSelectedRecords

In your form, create a text display object with the following formula:
arraysearch(fgSelectedRecords,info("serverrecordid"),1,¶)+" of "+info("selected")+ignore("",FName)

where FName should be the name of a field in your database.

I think that if you have a field with a sequence of numbers, you can make an array of the numbers of the selected records, and find the place where the number of the viewed record is in the array. But that is just the method, not the details, as I am not fluent with array operations. The method will also not survive a sort of the records, but you can resequence the field after a sort.

Hugo, that is a clever idea. I didn’t think of that because it won’t perform well if the number of selected records is large (more than a few thousand records). But for many databases, it will work well.

Keep in mind also that this will only work if you do all selections thru this button. The number will be incorrect if you select some other way, or if you sort the database after doing the selection.

I suspect that FileMaker builds an internal array with the found records, so it is easy for them to get the number you want. But that’s not how Panorama works. Panorama is always working with the entire database, not with a subset. It simply marks the found records, but they are still scattered through the entire data set, not gathered into a compact list. So Panorama could calculate the number you want, but for large databases the performance would be awful because Panorama always would have to scan the entire database to find out the record number, not just the small number of found records.

@BruceDeB, thank you! I now have a number of avenues to pursue!

@admin, Thank you! No know one of the fundamental differences between Panorama and FM and its implications is good!

Of course the fundamental difference is that Panorama is completely in memory, vs. on disk for FM (and most other database software). You might find this video interesting, there is also a link to it at the bottom of the provue home page. It’s not specifically about Panorama vs. FileMaker, but about in memory vs. disk based database technology in general.

I could be off, but it seems some of the solutions offered miss what naren17 wants to do. A selection of all records is made. So you are working with a subset of records that can change in quantity, and maybe be sorted.

Those selected (and maybe sorted) records in some order. There’s a first record, a last record, and records in between. So with each selection, a record’s position within the subset can change.

Thus, after the subset is created with a selection/sort, then you identify those records by giving them a sequence number and displaying that on the form.

Arrays aren’t needed, a unique record number, permanently assigned to the record isn’t needed.

Just sequence a field after the selection is made and that subset of records will have the positional information (first, second, tenth…) asked for.

naren17, is that what you want?

@admin Thank you, Jim! Great lecture and easy to follow for a novice like me!

For my application, filling a field with a sequence in a server shared database environment is not ideal or even recommended. I had to come up with the array and unique number solution for this.

Of course, the array can be generated every time you sort or search as you propose.

I provide buttons in my applications for sorting and searching, triggering the code to re-calculate the array every time.

So far, I have not found a speed penalty. For one of my databases containing over 25,000 records and over 100 fields, the calculation is almost instantaneous.

Thank you @designer!

I naturally had the datasheet. The database has about 30 fields.

I then created a form. I added two fields to it.

I then undertook a search using the form. The search yielded 23 records.

I then went on to browse the selected 23 records. Since many of the records had same entries for the two fields, when I was advancing the records on the form, one by one, it was not clear whether I had advanced to the next record (which also had the same entries for those two fields) or whether I am still on the same record.

It was also not clear to me how many records to go before I will come to the found set.

I would like to have a counter on the top of the form which changes as I advance through the found set e.g. 3/23 → 4/23 —> 5/23 and so on.

Hugo’s solution is exactly what you are looking for.

Thank you! Will start with Hugo’s advice!