Jump to content

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

Recommended Posts

Posted

When I return a search result, I often use [FMP-LinkRecID] on each record returned to provide a link to a more detailed page of the record. However what I find cumbersome is having to go back to the list and click on the next item in the list.

What I want is a link in the detailed page that goes to the next record in the list that they found based on their search. I tried [FMP-LinkNext] but obviously this only works when a find is returned and many records are found.

How can I create a "Link to the next record in the found list" when in a format page of an [FMP-LinkRecID]

Thanks.

Posted

I am afraid that because web is stateless you don't have the choice for "Link to the next record in the found list".

You can take the last set search, add/replace number of records to "-skip" based on current record and do -max=1.

HTH

  • 1 month later...
Posted

Hi, folks! While researching the posts, I stumbled across macaroni's months old inquiry about linking to the next record. I have an old FMP4 db I keep on useful info and remembered something about this I read. I will paste it below as it was when I found it in the FileMaker site. I don't know if that is bad etiquette or not but I hate it when someone posts a reference and the source is no longer there. Here's the whole article. Hope it helps someone... --ST

http://www.filemaker.com/ti/106538.html

CDML Record Navigation with FMP Link Tag

------------------------------------------------------------------------

This article assumes that you have at least a basic knowledge of CDML, HTML, and creating FileMaker calculation fields.

CDML provides many useful tags that make navigating through a found set of records (commonly referred to as a "hit list") easier. Through the combination of -max,-skip and FMP-LinkPrevious and FMP-LinkNext tags, the computer can return subsets of the hit list with previous and next links on each page rather than the entire found set on a single page. If you have a found set of more than 100 records, it's easy to understand how having the ability to segment the found set is necessary.

But what if you want to take this a step further and provide previous and next links between each individual detail page? There are a few different ways to do this, but most of them involve some complex combination of frames and Javascript. The following solution is a much more elegant method that involves the creation of one additional calculation field and one of the most powerful CDML tags, FMP-Link. Here's how it's done:

First define the following calculation field:

Recordskip(Number result, Unstored):

Status(CurrentRecordNumber) - 1

This field must be placed on the layout that will be called by the "-lay" tag on your search page. It is also pertinent that it be defined as an unstored calculation. To define the calculation as unstored, click on the Storage Options button on the lower right hand corner of the Specify Calculation dialog box. Then, check "Do Not Store Calculation Results - Calculate only when needed." The purpose of this calculation is explained below.

The initial search page that you've created does not need to be changed at all. The only concern here is, as specified above, that the layout specified with "-lay" contains the unstored calculation field described above. The BODY of your format or results page should now contain something like the example below:

<TABLE>

[FMP-Record]

<TR>

<TD><A HREF="[FMP-Link:rmk]&-format=detail.html&-skip=[FMP-Field:Recordskip]&-max=1">[FMP-Field:Field1]</A></TD>

</TR>

<TR>

<TD>[FMP-Field:Field2]</TD>

</TR>

[/FMP-Record]

</TABLE>

<P>

[FMP-LinkPrevious]Previous[/FMP-LinkPrevious]

[FMP-LinkNext]Next[/FMP-LinkNext]

Notice that this format page does not use FMP-LinkRecID, the usual method of linking to a record detail page. FMP-LinkRecID is not necessary in this case, since the individual record ID, which is required for performing detail page operations such as editing, duplicating or deleting a record, is also passed to the detail page using FMP-Link.

FMP-Link (described in more detail in the CDML Reference database) is a powerful CDML tag that allows you to specify as a parameter one or more key letters. Each of these letters represents an omitted portion of the current page's URL. For this solution, three key letters must be specified: "r" which represents the current "-format" page; "m' which represents the current "-max"; and "k" which represents the current "-skip". Once these parts are omitted, they can be replaced using regular CDML URL syntax. The new format page should be your detail page, the max should be "1", since the detail page needs to show individual records, and the skip should be set to the field value of the calculation described above. The skip needs to be replaced because its value is different for every record in the found set. This is why the above calculation must be unstored. When there is a new found set, the calculation field is reevaluated and the data is sent to the web companion. The beauty of this solution is that once it is sent to the web companion and to the client browser, it is a hard coded link. There is no danger of another browser request altering any part of that link including the -skip.

The body of the detail page should look something like the following:

[fmp-if:currentaction.neq.find]

You have modified the record successfully!<P>

<a href="the_search.html">New Search</a> | <a href="[fmp-currenttoken: URL]&-max=25&-format=the_result.html&-find">Back to Hitlist</a>

[fmp-else]

<form action="fmpro">

<input type="hidden" name="-db" value="countries">

<input type="hidden" name="-RecID" value="[fmp-currentrecid]">

<input type="hidden" name="-lay" value="web">

<input type="hidden" name="-token" value="[fmp-link:rsmta]">

<input type="hidden" name="-format" value="the_detail.html">

<input type="text" name="country" value="[fmp-field:country]"><BR>

<input type="submit" name="-edit" value="edit">

<input type="submit" name="-dup" value="duplicate">

<input type="submit" name="-delete" value="delete">

[fmp-currentrecid]

</form>

<a href="the_search.html">new search</a> | <a

href="[fmp-link:krm]&-format=the_result.html&-max=25">

Back to Hitlist</a> | [fmp-linknext]next[/fmp-linknext] |

[fmp-linkprevious]previous[/fmp-linkprevious]

[/fmp-if]

This example detail page is fairly complicated since it is used to perform deleting, duplicating and editing. Because the skip and max parts of the link were modified on the previous page, fmp-linkprevious and fmp-linknext can be used for the previous and next links. Also included is a "Back to Hitlist" link. This is optional, of course, but if a "Back to Hitlist" link is not provided, the browser's back button will have to be clicked many times if you have navigated through the previous and next links.

FMP-Link, this time with the action modified to "find", can also be set as a token, so that if an action on a detail page has been carried out, the token can be passed to a "Back to Hitlist" on the resulting format page.

Posted

u could use some JS and fake the URL -links on the Details page where your would still use [FMP-LinkRecID] but incremented by 1 (RecID+1)...if u just need the "next>" functionality.

Just a though, I have not tried but I don't see why it would not work..

========details.html============

RecID:55

field

field2

field3

..

.

next record > <-- URL:.....&RecID=56

=============================

this would work, only for the consecutive records....I doubt that it will apply for the "found set" -- since I belive found set can be:

RecID=34

RecID=67

RecID=69

....

if I am wrong on the "found set and RecID" assignment then even better!

anyhow....just in theory at this point! laugh.gif

Posted

aghh that is too bad... I was hopeing that FM assings RecIDs without gaps.. frown.gif

Oh well...it was a thought !

Posted

This is one thing of FM I don't like..."their logic makes no sence"- why not keep a simple loop for RecID as a strings/variables/sessions/whatever that are progressive results?!.....just to think that I was only 7 sec. away from getting it laugh.gif

_thanx Anatoli for commenting & sharing

Posted

I feel your anxiety smile.gif

I often wonder, why we are with this stuff?

Probably mostly because there is nothing like FM, and FM is improving from version to version with enough speed and futures to allow us be productive and satisfy the needs of our customers.

In version 2 and 3 I was often forced to say -- "not possible". Now I know, that FM will cover 98% of my customer needs and the last 2% can be covered by plugins.

Also -- what was slow in previous version is working now, because of hardware development and falling prices of PC's.

  • Newbies
Posted

Hi all,

I am new to FM ... Thanks to this Forum, its helping me a lot.

I am facing a similar problem to the one discusses here.

I followed the the post #74381 but however, [FMP-Field:Recordskip] is giving me the calculated value of the original set and not the current found set. ( I have defined this field as unstored in the database. )

When I view the records in the browse mode - I find the Recordskip field having values with respect to the current foundset.

But on the web, I am not getting it right. Something weird is happenning. Donno what :

Can anyone help me out

Posted

Hi sat,

I can tell you what the problem is as I have tried before as well, but unfortunately I cannot tell you the solution as I have yet to find one.

On the web, you perform a find.

You receive your results page.

Now FM is showing just those found records.

When you click into a more detailed page, for example record_detail.html, the web needs to look at the whole database to find the relevant record id for the record you selected to view more information on.

So now the web is using the whole database rather than just the current found set, this is the case even though FM is still only showing the found set from the original find.

This was explained to me a while ago but I couldn't quite understand why it would do this so I put together a test which proves it.

I created a database with 3 fields: Name (text field), Country (text field) and c_RecordNumber (calc field)

c_RecordNumber= Status(CurrentRecordNumber)

I created 3 records:

1) Name-Ed, Country-UK

2) Name-Mike, Country-USA

3) Name-John, Country-UK

I display all 3 fields on the search_results page and all 3 on the record_detail page.

I perform a search on Country=UK

Search results show 2 records, these records show the field c_RecordNumber as 1 and 2.

Note, this is the RecordNumber not the FM recID.

Now I click on the second record found, this takes me to record_details.html. Now the RecordNumber shows as 3. This proves it is looking at the whole database once you get to record_details.html.

When showing just the 2 found records, this record was number 2

When viewing this actual record it becomes number 3, which is correct when viewing all records in the DB.

I hope this has been some help to you, but as I say it's not a solution, just the cause.

Ed.

  • Newbies
Posted

Hi Ed,

That was a detailed explanation. Thanks...

I was also able to figure out what was actually happening.

But however the post #74381 explains that it will work for search results - detail page. Thats why i was wondering !!!

Hope some one comes out with a solution ..

-sat

  • 2 weeks later...
Posted

Original desire: "What I want is a link in the detailed page that goes to the next record in the list that they found based on their search. I tried [FMP-LinkNext] but obviously this only works when a find is returned and many records are found."

sat, "But on the web, I am not getting it right. Something weird is happenning. Donno what ???"

sat, "Hope some one comes out with a solution .."

Well I have looked at this situation. I too had problems. IMO the tech paper on this sucks rotten eggs through a bent straw. I am posting my solution on the Sample Files forum. Look for "CDML Linking to the next record". I hope you will find it useful.

This topic is 7869 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.