Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Need help with format file...please

Featured Replies

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!

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> ... ?

  • Author

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.

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...

You may need to use a little bit of Javascript to either display or hide the "type".

Good Luck.

Garry

Wow, we posted in the same second Garry smile.gif

Lucky it wasn't a Script wink.gif

Garry

  • Author

So it sounds like javascript is the way to go. Unfortunately, that's something I know nothing about. Can someone push me in the right direction?

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.

  • Author

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.

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

It would probably involve redoing you database, but it looks like you are trying to do something like I was in this post:

web page

Are you happy with FM displaying everything from your databases to the web? Are there some secrets, customer info, buying prices etc?

  • Author

YAY! You all are awesome! From your wonderful posts I was able to find a solution to my problem. Thank you ALL so so so so so so much!

- Kim

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

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".

Garry! This is really cool - thanks!

re: Lucky it wasn't a Script

You must mean JavaScript. ScriptMaker would not have a problem with that.

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

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.