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.

Forcing a field to return number as Asterisks

Featured Replies

Hi

I have a calculation field returning text of several fields and I would like to add a star rating to the end of the list of text. I have a field called STARS which has a number (1-5 entered), how can I force the calculation to return an asterisk for the number of stars equivalent to the number in the STARS field ??

Right("*****"; STARS)

  • Author

WOW !

That easy - magic, is it possible to change the size and make it bold too ?

Thanks

  • Author

Here is my script - I am trying to append fields with a comma to separate them, but I would like a full stop after the address before the Postcode. I cannot see how to do this without getting a comma before the full stop if the preceeding field is empty ??

Case ( not IsEmpty ( Main::Title) ; Main::Title) & ", " & (Main::Address1) & ", " & (Main::Address2) & ", " & Case ( not IsEmpty ( Main::Address3 ) ; Main::Address3) & ", " &

Case ( not IsEmpty ( Main::Address4 ) ; Main::Address4 ) &

Case ( not IsEmpty ( Main::Address5 ) ; Main::Address5) & ". " & (Postcode) & " " & "Tel: " & (Tel) & " " & Right("*****"; STARS )

TextStyleAdd("hello bold world"; bold)

TextSize("bigger text"; 18)

I am trying to append fields with a comma to separate them, but I would like a full stop after the address before the Postcode. I cannot see how to do this without getting a comma before the full stop if the preceeding field is empty ??

The List() function will take any number of arguments and separate them by "¶". It will gracefully omit blank arguments. Replace the "¶" with a comma and you're done.

Substitute(

List(

Main::Title;

Main::Address1;

Main::Address2;

Main::Address3;

Main::Address4;

Main::Address5

); "¶"; ",")

& "." &

& Postcode & " " & "Tel: " & Tel & " " &

Right("*****"; STARS)

Edited by Guest

  • Author

Thanks for all your help - really good to be able to get somewhere when you cannot see the wood f t t ettc.

BUT ! 'List' seems to return an 'unknown function' in my calculation setup dialogue box - I am using FM 8.5

'List' seems to return an 'unknown function' in my calculation setup dialogue box - I am using FM 8.5

List() should be available to you. I see it in my v8.5 Advanced.

Edited by Guest

  • Author

Hi

All I did was to copy the posted reply, into my calculation field and it highlighted the word 'List' and said unknown function. I just assumed that the post was a direct replacement for my 'Case' calculation.

If not please advise.

There are two [color:red]& in a row. Remove the [color:red]& before [color:blue] Postcode

i.e.

& "." &

[color:red]& Postcode & " " & "Tel: " & Tel & " " &

Lee

Edited by Guest

Right("*****"; STARS)

To not hard-coding the text string:

Substitute ( 10 ^ stars - 1 ; 9 ; "*" )

  • Author

Aaaaargh !

I am not on the very latest version of 8.5

Will do an update to get the list function

Thanks

I think they just want to hide 1 to 5 number that would appear in STARS.

i.e. 12345 would equal ***** not 12,345 Stars.

  • Author

Oh dear - now the database will not load into FM 9.0 and FM 8.5v2 - crashes app :?

I have managed by trial and error to get the calculation to add a comma if the field after it has data and to add a full stop if not. Perseverence !

  • Author

No, the data in the field is a single number from 1- 5, so the Substitute ( 10 ^ stars - 1 ; 9 ; "*" ) works fine - both solutions work fine in fact.

Great help - is there anyway to test my build to see why it won't load in later versions ??

  • Author

Hmmmm, just noticed a problem - if the entry does not have a star rating i.e., number = '0' then it shows an actual zero instead of stars. How can I get it to display nothing :?

I tested this in 8.5 and in 10

  • Author

Tested what ? It was my database that crashed the programs - how can I test to see what is wrong ??

sorry, I meant that I tested the calculation.

If you want the file test, then Attach it to a Reply.

Lee

It openned right up for me. What am I suppose to check for?

  • Author

What ?

I loaded FM8.5 then FM 9.0 and it crashed both - admittedly I was using the trial versions :-)

  • Author

Try the '0' entry in the STARS field - it returns a zero - would be great if it returned nothing (you need to be in the layout called LINE ENTRY .....

I don't follow?

If I put a 0 in the Star field, it show nothing as the result. What did you want it to show?

BTW, do you have iChat, we could probably walk you through this easier using it.

Lee

  • Author

Hi

Yes [email protected] - I am on now.

The 'no star' entry returns a zero - use the Line Entry layout to see the zero

If ( STARS ; TextSize ( Substitute ( 10 ^ STARS - 1 ; 9 ; "*" ) ; 18 ) )

  • Author

WOW !

You are a star :-))

Thanks - very subtle changes there - like it - not sure I understand completely but it is elegant

BTW: why so many ( and unnecessary ) UNSTORED calculations ?

  • Author

I have no idea - I thought they were necessary ! Most are to get nice looking tick boxes to display, whilst still keeping a data value.

  • Author

Would be great to learn some more :-) Why are they unnecessary and why should they be stored ??

Unstored calculations slow down the program.

I do not know if those field are necessary...

I meant that you make them uselessly UNSTORED, while they can be stored.

Sometimes we need to have an unstored calculation ( for example a calculation based on a Get( ) function ) but none of your needs to be.

  • Author

Thanks for the reply - I will look into that - I had noticed that it had gone slow :-)

Well 15 of them cannot be stored - as they reference the global tick box graphic - unless of course you have a much more elegant solution ??

example If(Laundry data= 1; Global::Tick; Global::Cross)

Edited by Guest

Well 15 of them cannot be stored - as they reference the global tick box graphic

In fact those calculated fields may well not exist, would be enough of simple fields of type container.

Didn't you scripted each tick ?

  • Author

OK - I will have a go - sounds cool! Having less is always better.

Well I did have a chance to change one file to a container and deleted the unstored calculation, which didn't work - there is nothing now that tells the data box which graphic to use in each state (that was what the calculation was for ) ??

Or am I missing something ?

Edited by Guest

You missed to SET that field with the appropriate picture using the same script ( with another SetField [ ] or a modified one ) that you are now using for set a field to 0/1

  • Author

I see, but SetField doesn't allow for an either or - does it ?

I tried with an If and that seems to work.

See attached ??

screenshot_01.jpg

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.