Jump to content

search results...display horizonally?


calicoskies
 Share

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

Recommended Posts

Hello,

I have a FileMaker DB hosted on a server running Lasso. But, I am using mostly CDML tags (except for the call tag) since Lasso can read those.

The web site uses a search page to find a group of products, then it is displayed on a results page. The results page has the following code,and works well.

code:


[fmp-record]

[fmp-field: logoURL, raw]

[fmp-field: pictURL, raw]

[fmp-field: Item_Name]

Part Number: [fmp-field: Part_Number]

Description: [fmp-field: specs, break]

List Price: $[fmp-field: List]

Sale Price: $[fmp-field: Sale]

[/fmp-record]

This makes the products all display, but, they display one after another vertically on the page. I'd like to be able to display 2 or 3 across on a page, and then have it start filling the next row with 2 or 3 items. (now it does one across and then down)

How do I code that? I had suggestions from lasso developers, but I just don't understand the lasso code enough to convert my pages frown.gif" border="0

Help?

-Lynn

Link to comment
Share on other sites

This is off the top of my head, so there might be a better solution out there, but...

My approach would be to create a field in the database itself:

New_Row (unstored calculation) = Mod(Status(CurrentRecordNumber), 3) = 0

New_Row will evaluate as 1 in every record in the found set whose record number is evenly divisible by 3. This is if you want a new row after every third record

In your CDML code, you would use the following:

code:


<table>

<tr>

[fmp-record]

<td>

[fmp-field: logoURL, raw]

[fmp-field: pictURL, raw]

[fmp-field: Item_Name]

Part Number: [fmp-field: Part_Number]

Description: [fmp-field: specs, break]

List Price: $[fmp-field: List]

Sale Price: $[fmp-field: Sale]

</td>

[FMP-If:New_Row.eq.1]

</tr>

<tr>

[/FMP-If]

[/fmp-record]

</tr>

</table>


I haven't tested this, but you may want to give it a shot. Hope it helps!

[ December 14, 2001: Message edited by: The Bridge ]

Link to comment
Share on other sites

Use [FMP-ELSE] and & nbsp; (remove the space between the & and n). Check to see if there is data and if there isn't just output a non-breaking space.

<table ...>

<tr>

[records]

<td>

[FMP-IF: Field: your_field .neq.]

...my fields...

[FMP-ELSE]

& nbsp;

[/FMP-IF]

</td>

[if repetition)==2]</tr><tr>

[/if]

</tr>

</table>

Sorry the javascript didn't work for you. I'd be happy to check the code.

[ December 17, 2001: Message edited by: dspires ]

Link to comment
Share on other sites

quote:

Originally posted by Lynn:

(I had difficulty with a javascript error from dspires solution, and the solution from The Bridge was so close to working, but it produced a row of 4 across the page. Thanks for trying though!)

No problem... you can "fix" the calculation I gave you by changing one value:

New_Row (unstored calculation) = Mod(Status(CurrentRecordNumber), x) = 0

Change x to the number of columns you want to display per row.

Link to comment
Share on other sites

dspires - This may be a little off-topic, but I also need to display my data horizontally, but in a calendar format. I've been hoping to tweak the javascript code you provided to create a 'calendar' look for my database output, building a separate table for each month....have you done anything like that with the code, or do you have any suggestions on how to set the variables so that each calendar table starts/stops on the correct day for each month? Thanks a million! crazy.gif" border="0

Link to comment
Share on other sites

Not directly related to your question, but I've built a calendar in FMP. The way to get the first day of month to begin on the right day of week is surprisingly complicated!

It involves working out the day of week of the first day of the month, then finding the right number of days of the previous month to make up the shortfall, then "hiding" or greying-out those first few days. In FMP it invloves a monster of a calculation and a complicated script as well.

Link to comment
Share on other sites

quote:

Originally posted by Vaughan:

Not directly related to your question, but I've built a calendar in FMP. The way to get the first day of month to begin on the right day of week is surprisingly complicated!

It involves working out the day of week of the first day of the month, then finding the right number of days of the previous month to make up the shortfall, then "hiding" or greying-out those first few days. In FMP it invloves a monster of a calculation and a complicated script as well.

If you are referring to a calendar that will display on a web page, I would be ever so greatful if you sent me a copy of the calc field and script. I'm not afraid to use a script over the web if that's the only way to get something done. And if it works, it works!

I'm building a Training Registration database for our department of 10,000+ people, and our customer's require a display of the upcoming classes in a calendar format. Right now, this means manually editing the pages, which quickly gets them out of sinc with the database-driven pages. And the training may be scheduled as far out as the year 2004!

[ December 17, 2001: Message edited by: MeltDown ]

Link to comment
Share on other sites

Thank you both for the help. I'm part way to a solution, and wonder if you could help me with one last piece of code?

(I had difficulty with a javascript error from dspires solution, and the solution from The Bridge was so close to working, but it produced a row of 4 across the page. Thanks for trying though!)

I do have this working solution that needs tweaking though:

code:


<table ...>

<tr>

[records]

<td>

...my fields...

</td>

[if
frown.gif" border="0
repetition)==2]</tr><tr>

[/if]

</tr>

</table>

This allows me to have 2 across products on a page, which is perfectly fine. BUT, if I only have 1 product, it leaves a blank spot where a cell should be for a second product. Looks bad that way. How do I write an IF statement that will look to see if the last record in the table is a single item, and force it to create a blank cell of a certain width for that second space?

Thanks again

Lynn

Link to comment
Share on other sites

MeltDown,

I don't have any web enabled FMP calendar application.

I do however use a web enabled dynamically database driven calendar application (behind firewall). The only problem is that the database is Access and Cold Fusion provides the web interface. If you are familiar with Cold Fusion, SQL, and HTML using CSS, I can send you the code and you can try your hand at modifying it for FMP.

Link to comment
Share on other sites

I'm so close to getting this to work 100%. It's working on 75% of my issues now. Thanks to you all for the suggestions. I've incorporated many of your ideas and a few of my own and am nearly there.

I have one last IF statement that I need, but I can't seem to properly code to work in my results page. Help would be soooooo appreciated. (I've switched to Lasso tags in my If-Else because I could find better documentation on how to write those)

Using FM Pro db.

When a search is made for products, you'll get either 1, 2, 3, or 4 products on a results page. My coding works for displaying 1, 2 and 4 products in a certain format. However, I can't make it work for 3 in the desired format. I need another nested IF, or Else If in there, but everytime I create one, the whole thing breaks down completely.

When 1 product is found, it plops my record into a formatted table cell, creates a blank narrow black cell, and then creates a blank wider white cell to show a blank spot where a second product would go. That is perfect.

When 4 products are found, it displays them 2 across on the page, makes a new row and displays 2 more cells across, everything in their own little formatted table cells. That is working great.

The problem is finding 3 products. I want it to put the first 2 products 2 across, and the last product one across plus add a blank white cell. I can't do it.

Can anyone help?

Following is the code I have so far that works.

thanks very much,

Lynn

<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0>

<TR>

[fmp-record]

<TD HEIGHT=215 WIDTH=1 VALIGN=TOP BGCOLOR="#000000"><IMG SRC="../Resources/_clear.gif" BORDER=0 WIDTH=1 HEIGHT=1 ALT=""></TD>

<TD WIDTH=298 VALIGN=TOP BGCOLOR="#ffffff">

<BR>

[fmp-field: logoURL, raw]</SPAN></FONT>

[fmp-field: pictURL, raw]</SPAN></FONT>

[fmp-field: Item_Name]

<BR>

Part Number: [fmp-field: Part_Number]

Description: [fmp-field: specs, break]

List Price: $[fmp-field: List]

<BR>

Sale Price: $[fmp-field: Sale]

[if frown.gif" border="0 (Found_Count)=='2') || ((Found_Count)=='3') || ((Found_Count)=='4')]

<IMG SRC="Resources/bigspacer.gif" BORDER=0 WIDTH=298 HEIGHT=3 ALIGN=ABSBOTTOM HSPACE=0 VSPACE=0 ALT=""></TD>

<TD WIDTH=1 VALIGN=TOP BGCOLOR="#000000"><IMG SRC="../Resources/_clear.gif" BORDER=0 WIDTH=1 HEIGHT=1 ALT=""></TD>

[if: (repetition)==2]

</TR><TR> [/if]

[Else: If frown.gif" border="0 (Found_Count)=='1')]

<BR><IMG SRC="../Resources/bigspacer.gif" BORDER=0 WIDTH=298 HEIGHT=3 ALIGN=LEFT HSPACE=0 VSPACE=0 ALT=""></TD>

<TD WIDTH=1 VALIGN=LEFT BGCOLOR="#000000"><IMG SRC="../Resources/_clear.gif" BORDER=0 WIDTH=1 HEIGHT=1 ALT=""></TD>

<TD WIDTH=298 VALIGN=TOP BGCOLOR="#ffffff"><IMG SRC="../Resources/bigspacer.gif" BORDER=0 WIDTH=298 HEIGHT=3 ALIGN=LEFT HSPACE=0 VSPACE=0 ALT=""></TD>

<TD WIDTH=1 VALIGN=TOP BGCOLOR="#000000"><IMG SRC="../Resources/_clear.gif" BORDER=0 WIDTH=1 HEIGHT=1 ALT=""></TD>

</TR>

[/if][/fmp-record]

</TABLE>

Link to comment
Share on other sites

quote:

Originally posted by Vaughan:

Why not generate the *image* of a calendar and display that?

Vaughn - Thanks for the suggestion, but I need to have it database driven so that the person viewing the calendar can click on the class they want to be registered automatically. (Am I mis-understanding your recommendation??)

Dspires - I work with some people using ACCESS and Cold Fusion, but I don't use it myself. If you could go ahead and send it to me, if I can get it to work I could return the FMP version to you or this Forum. Thanks a million! laugh.gif" border="0

Lynn - You could try changing your "Else" to [Else: If (Found_Count)=='1')||(Found_Count)=='3')]. Hope that helps!

Merry Christmas!

[ December 19, 2001: Message edited by: MeltDown ]

Link to comment
Share on other sites

  • 3 months later...
  • 6 months later...
  • Newbies

I'm having a little bit of trouble with this.

Even though the New_Row calculation shows correctly in the database, when it goes through my format file it seems that the Status(CurrentRecordNumber) is using the record number based on the whole file, not just the found set.

I've included the ",Raw" tag and the calculation itself in unstored. Have I missed something else?

thanks,

Link to comment
Share on other sites

This topic is 6952 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
 Share

×
×
  • Create New...

Important Information

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