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

Formating numbers

Featured Replies

I want to display a number field on a page (a price). The field is in my main DB through a relationship. The field appears unformatted (5.2 instead of 5.20)on the web.

I tried specifying a number format on the layout that I use (in the main DB), it didn't change the format on the web.

How can I specify the number of decimal to display on the web ?

Thanks

Do calculation field with Num to Text and display the Text field on Web.

Are you using Instant Web Publishing?

  • Author

I am not using Instant Web Publishing. (I am using Custom Web Publishing)

I would have liked to avoid using a calculation field but if it is the only way....

Thanks

Try entering the value in the field as 5.20 and seeing if it displays that way on the web. That'll tell you that the web displays exactly as they are entered.

Here is one I use:

"$" & Left(NumToText(Round(selling_price_ex,2)+0.0001),Length(NumToText(Round(selling_price_ex,2)+0.0001))-2)

I'm looking for a better way. So any advice appreciated!

All the best.

Garry

Maria Langer, in her book Database Publishing with FileMaker Pro on the Web, provides such a calculation on page 317. Only problem is she has written it incorrectly. But it is easy enough to fix because it is so obvious.

  • 2 weeks later...

if you are using dreamweaver to make the cdml pages there is an option to enter preformatted text.

using this you can select the fmp replacement tag and click on the style menu on the selection properties

there are other options such as heading or paragraph. selecting preformatted will enter the text the way it is formatted in filemaker eg bold italic of number formats smile.gif" border="0

  • 7 months later...

Can you try also [FMP-Field: Field name , Format]?

It works in most (all?) cases smile.gif

I can't find that one in my "CDML Reference" database frown.gif

Garry

I think he meant [fmp-field: fieldname, encoding]

FWIW, on seeing that I opened my copy of the Sample File which Stephen posted for me under "Summary Field thru cdml". I stuck the following on one of the results format files:

<p>[fmp-field: totcost, raw]

<p>[fmp-field: totcost, break]

<p>[fmp-field: totcost, url]

<p>[fmp-field: totcost, html]

The field, totcost, is a summary field. In the db it is formatted to display the dollar sign and decimal point with two places. Thus in the db a summary might appear as $38.80.

In the solution and the format file into which I wrote these four lines, each returned 38.8 to the browser. However, the solution as I offered it does display the number (as text) in the format $38.80 which is what is displayed on the browser screen.

So if [fmp-field: fieldname, encoding] is what was meant, then the answer to the question which accompianied that is "No".

It is not there frown.gif

Just try it. It mostly works, although I didn't make the syntax working from related fields.

Anatoli seems insistant on [fmp-field: fieldname, format].

I like that.

So I went to the same place on the same format file and wrote [fmp-field: totcost, format]. I then ran through the browser solution and - shut my mouth - there on the browser was $38.80 in response to the tag.

Anatoli, Tres cool. wink.gif

I must admit, that I didn't discovered that myself smile.gif

I inherited some spaghetti like code, tangled all together especially JavaScript and CDML.

But it works. It is horrible to add or modify something, but it works. Something is so slow, like 17 sec for search, instead of my usual 1 sec.

Mistakes.

But there was sitting this undocumented gem smile.gif

There is the problem with WebCompanion when serving the FORMAT number from PORTAL like [FMP-field:PODtl::QOTL, Format]

The designer of WebCompanion wrongly used old syntax for specifying size of FONT. WC is inserting automatically the


<FONT FACE="Arial" SIZE="-1">


syntax just before the Number with FORMAT in Portal. That is most unfortunate, because that syntax is modifying user Font and it tries to modify also size.

Remedy for this is CSS.

Just put in head of your document:


<style type="text/css" media="screen"><!--

FONT { font-size: 12px; font-family: Arial, Helvetica, Geneva, Swiss, SunSans-Regular }

--></style>


and all should be fine.

Obviously, you must use CSS formatting through page. That is also preferred way of handling Fonts and Sizes on web for past 3 years.

Create an account or sign in to comment

Important Information

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

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.