Jump to content

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

Recommended Posts

Posted

Basically I have a database of schools, teachers and students. When doing a search for a specific school, for example, I would like to see something like -

Teachers

- Mrs. Red

- Mrs. White

- Mrs. Blue

Boys

- Larry

- Mo

- Curly

Girls

- Hope

- Joy

- Faith

Instead, what I get is -

Teachers

- Mrs. Red

Teachers

- Mrs. White

Teachers

- Mrs. Blue

Boys

- Larry

Boys

- Mo

Boys

- Curly

Girls

- Hope

Girls

- Joy

Girls

- Faith

What modification do I need to make to my format file so that the category (Teachers, Boys, Girls) does not repeat for each record? Thanks in advance!

Posted

A table?

[FMP-record] and [/FMP-record] appropriately placed?

<tr><td>Teacher...

<tr><td>[FMP-Field: teacher]<br>...

<tr><td>Boy ...

<tr><td>[FMP-Field: boy]<br> ... ?

Posted

That certainly makes sense, but is not quite how I have my database set up. I have fields for School, Type (teacher, boy, girl) and Name. So my format file is very short and sweet -

<table>

[FMP-RECORD]

<tr>

<td>[FMP-Field: type]</td>

</tr>

<tr>

<td>[FMP-FIELD: name]</td>

</tr>

[/FMP-RECORD]

</table>

So, with the way it is now, since every name has a "type" associated with it, the "type" repeats for every record. I understand what it's doing and why, I just would like to know how to force the "type" (teacher, boy, girl) to display only once.

Posted

There will be many ways. One will be to display TYPE just from first record. That can be achieved with JavaScript.

Or make that in FM as relation and display record and portal.

And, and, and...

Posted

re: ...but is not quite how I have my database set up. ... So my format file is very short and sweet -...

re: Unfortunately, that's something I know nothing about.

Sounds like short and sweet is turning into long and bitter.

re: ... the way to go.

Since you do not know JS you might consider db file and format file redesign. Even if you learn (or get help with) JS, you still may need to consider db file and format file redesign.

Bon chance.

Posted

It seems you are right Unable. This is turning into long and bitter.

Not to confuse things, but the teacher/boy/girl scenario was just that, a scenario. Something to easily describe what I'm trying to accomplish. I'm actually adding my company's products to a database so that some day, they will all be generated by CDML. I'm currently hand coding a lot of the pages, including the line list, which will turn into a huge burden as the number of our products increases.

So the actual site I'm working on, if you care to see my dilemma firsthand, is - http://cgi.stratitec.com/FMPro?-db=main.fp5&-format=CPUB/subcattest.html&webactive=show&brand=cpubuilders&-op=eq&-sortfield=category&-find

I really don't know what changes I could make to the db or format file to get this to display all of our products on one page correctly, short of hand coding the html, which is what I'm already doing.

Posted

You could create a self joining relationship for each product type, then create a portal for each relationship. That way you wouldn't have to make a seperate file for product types.

So for each type of product you need:

a global variable with the product type

a relationship between each global variable and the product type

a portal for each relationship

It's hard to explain, but take a look at the attached file. It shows a basic setup. Take a look and see if makes sense and could be of use to you.

Also, portals are pretty handy with CDML and easy to use, especially if you don't need to edit/delete/add rows via the web. Just check the reference databse and look for some examples on the forum.

Example.zip

Posted

I've had a similar problem, where changing the display was possible, changing the database was too complex. Try the following:

<table>

<TR bgcolor=grey>

<TH>Teachers:</TH>

</TR>

[FMP-RECORD]

[FMP-if:Type .eq. Teacher]

<tr>

<td>[FMP-FIELD: name]</td>

</tr>

[/FMP-if]

[/FMP-RECORD]

<TR bgcolor=blue>

<TH>Boys:</TH>

</TR>

[FMP-RECORD]

[FMP-if:Type .eq. Boy]

<tr>

<td>[FMP-FIELD: name]</td>

</tr>

[/FMP-if]

[/FMP-RECORD]

<TR bgcolor=pink>

<TH>Girls:</TH>

</TR>

[FMP-RECORD]

[FMP-if:Type .eq. Girl]

<tr>

<td>[FMP-FIELD: name]</td>

</tr>

[/FMP-if]

[/FMP-RECORD]

</table>

The data will display however you have it sorted.

HTH! cool.gif

Posted

Here is one you can use:

</head>

<body><table>

<tr><td><b>Type</b></td><td><b> Name</b></td></tr>

<script>var current_type = "";

[FMP-Record]

if (current_type == "[FMP-Field:type]")

{ document.write("<tr><td></td><td>[FMP-Field:name]</td></tr>"); }

else

{

document.write("<tr><td>[FMP-Field:type]</td><td>[FMP-Field:name</td></tr>);

current_type = "[FMP-Field:type]";

};

[/FMP-Record]

</script>

</table></body>

All the best.

Garry

p.s. This is assuming that the data is sorted by "Type".

Posted

Hi, I think you're calling the wrong database here!

Don't you need a file of "schools" with portals to separate files for "teachers", "boys" and "girls"? I think you could do it with a single file, but not as effectively.

Like this:

[FMP-RECORD]

<TABLE >

<TR>

<TD WIDTH=321>

<P>[FMP-FIELD: school]</P>

</TD>

</TR>

<TR>

<TD>

<P>[FMP-PORTAL: teachers]

<TABLE>

<TR>

<TD>

<P>[FMP-FIELD: teachers::theteacher]</P>

</TD>

</TR>

</TABLE>

[/FMP-PORTAL]</P>

</TD>

</TR>

<TR>

<TD>

<P>[FMP-PORTAL: girls]

<TABLE>

<TR>

<TD>

<P>[FMP-FIELD: girls::thegirls]</P>

</TD>

</TR>

</TABLE>

[/FMP-PORTAL]</P>

</TD>

</TR>

<TR>

<TD>

<P>[FMP-PORTAL: boys]

<TABLE >

<TR>

<TD>

<P>[FMP-FIELD: boys::theboys]</P>

</TD>

</TR>

</TABLE>

[/FMP-PORTAL]</P>

</TD>

</TR>

</TABLE>

[/FMP-RECORD]

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

regards, jeff

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