Jump to content

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

Recommended Posts

Posted

Filemakerpro 6 Unlimited

Windows XP Professional

Here's my situation:

I've got a 2 dbs: sample.fp5 and sample_plant.fp5. Sample.fp5 contains information about individual samples (date in, date out, plant, etc) while sample_plant contains just one field -- plant. I've got a relationship from sample_plant to sample matching the plant name, and a record for every single type of plant that appears in sample.fp5. The reason for doing this is because I want to have a heading -- plant -- when I generate the search results page.

The idea is to first do a search against the sample_plant.fp5 db to pull up every single type of plant available, and then performing an inline action searching for all occurances of a particular plant name in sample.fp5.

The output should look like this:

Plant 1

-------

1. date in date out examiner etc

2. date in date out examiner etc

.

.

.

Plant 2

-------

1. date in date out examiner etc

2. date in date out examiner etc

.

.

.

on so on and so forth for every type of plant in sample.fp5.

It seems to work, but my problem comes in when I try to search for a particular date in or date out in my secondary inline action. Question: is there any way to pass data between nested inline actions?

Example:

search page:

FMPro?-db=sample_plant.fp5&-format=results.html&-max=10&plant=*&date_in_month=January&-find

results.html

[FMP-record]

[FMP-field: plant]<br>--------<br>

[FMP-InlineAction: -db=sample.fp5, -max=all, plant={FMP-field: plant}, date_in_month={FMP-field: sample::date_in_month}, -find]

[FMP-record]

[FMP-field: date_in_month], [FMP-field: date_out_month], [FMP-field: examiner]<br>

[/FMP-record]

[/FMP-InlineAction]

[/FMP-record]

I can't seem to get {FMP-field: sample::date_in_month} from sample_plant.fp5 to replace the portion of the inline action against sample.fp5. Sorry for the terribly long post, and any help would be greatly appreciated!

Posted

I would just use one file, sample_plant.fp5 I would sort by plant and use some Javascript to print a heading and break on each plant.

All the best.

Garry

p.s. You could also use a Portal in the sample.fp5 file and use [FMP-Portal]

Posted

Garry,

Thanks for the quick reply. Unfortunately, if I were to use portals, I wouldn't be able to pull up a particular plant with a specified date_in_month, if I wanted to search for all plant entered during a given month (or can I? I don't know.)

Here's what I have tried to do using Javascript:

<head>

<script language="javascript">

var date_month="[FMP-field: date_in_month]";

var date_year="[FMP-field: date_in_year]";

</script></head>

and in the body somewhere:

<script>document.write("[FMP-InlineAction: -db=sample.fp5, plant={FMP-field: plant}, date_in_month="+date_month+", date_in_year="+date_year+", -max=all, -find]");</script>

and with the [FMP-currentfind] functionality I discover that the variable inserted into date_in_month to be +date_month+ and date_in_year is +date_year+. When I do a separate document.write, it displays the correct information, eg: date_month is April and date_year is 2003.

Is there something wrong with the Javascript?

Again, thanks for any help you can give.

Cheers!

weecc

PS: I would really appreciate it if you could show me how you would go about using Javascript to print the header and breaks. Thanks.

Posted

Here's how I would do it, sans javascript:

PAGE 1:

<INPUT TYPE="hidden" NAME="-DB" VALUE="sample_plant.fp5">

<INPUT TYPE="hidden" NAME="-Lay" VALUE="web">

<INPUT TYPE="hidden" NAME="-Format" VALUE="results.htm">

<INPUT TYPE=text NAME=date_in VALUE="">

<INPUT TYPE="submit" NAME="-find" value="FIND">

Posted

Here's how I would do it, sans javascript:

PAGE 1:

<INPUT TYPE="hidden" NAME="-DB" VALUE="sample_plant.fp5">

<INPUT TYPE="hidden" NAME="-Lay" VALUE="web">

<INPUT TYPE="hidden" NAME="-Format" VALUE="results.htm">

<INPUT TYPE=text NAME=date_in VALUE="">

<INPUT TYPE="submit" NAME="-find" value="FIND">

PAGE 2 (i redo the search for each record to set the right tokens):

[fmp-record]

Posted

This is how I would be tempted to achieve the report.

Here is the URL to start:

/FMPro?-db=sample_plant.fp5&-lay=web&-format=results.html&date_in_month=xxx&date_in_year=xxxx&-sortfield=plant&-find








This script would be in the body of the "results.html" format file:




<script>plant_name = "";



[FMP-Record]



if (plant_name == "[FMP-Field:plant]")



   {



   document.write("[FMP-Field:xxxxx]<br>");



   }



else



   {



   plant_name = "[FMP-Field:plant]";



   document.write(plant_name);



   document.write("[FMP-Field:xxxxx]<br>");



   }



[/FMP-Record]</script>

Hope this is enough to get you going.

All the best.

Garry

Posted

Here's how I finally solved the problem. I took your advice Garry, and only searched against one db: sample.fp5:

FMPro?-db=sample.fp5&-format=results.html&plant=xxx&date_in_month=xxx&date_in_year=xxxx-sortfield=plant&-find

in the results.html <HEAD> section:

<script>

var records = "[FMP-currentfoundcount]";

var plant = new Array (records);

var i = 0;

plant[0]="start";

i++;

</script>

in the body, between the [FMP-record] tags:

[FMP-record]

<script>

var planttemp="[FMP-field: plant]";

plant=planttemp;

if (plant != plant[i-1]) {

document.writeln("<br><strong> Plant : " + plant + " " + "</strong>");

i++;

}

</script>

... the rest of the record details come here ...

[/FMP-record]

I hope this comes in handy for someone else. Anyway, thanks for the help, Garry and CyberSport.

Cheers!

weecc

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