Madwolfie Posted July 8, 2010 Posted July 8, 2010 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 ??
Madwolfie Posted July 8, 2010 Author Posted July 8, 2010 WOW ! That easy - magic, is it possible to change the size and make it bold too ? Thanks
Madwolfie Posted July 8, 2010 Author Posted July 8, 2010 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 )
TheTominator Posted July 8, 2010 Posted July 8, 2010 (edited) 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 July 8, 2010 by Guest
Madwolfie Posted July 8, 2010 Author Posted July 8, 2010 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
TheTominator Posted July 8, 2010 Posted July 8, 2010 (edited) '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 July 8, 2010 by Guest
Madwolfie Posted July 8, 2010 Author Posted July 8, 2010 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.
Lee Smith Posted July 8, 2010 Posted July 8, 2010 (edited) 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 July 8, 2010 by Guest
Raybaudi Posted July 8, 2010 Posted July 8, 2010 Right("*****"; STARS) To not hard-coding the text string: Substitute ( 10 ^ stars - 1 ; 9 ; "*" )
Madwolfie Posted July 8, 2010 Author Posted July 8, 2010 Aaaaargh ! I am not on the very latest version of 8.5 Will do an update to get the list function Thanks
Lee Smith Posted July 8, 2010 Posted July 8, 2010 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.
Madwolfie Posted July 8, 2010 Author Posted July 8, 2010 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 !
Madwolfie Posted July 8, 2010 Author Posted July 8, 2010 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 ??
Madwolfie Posted July 8, 2010 Author Posted July 8, 2010 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 :?
Madwolfie Posted July 8, 2010 Author Posted July 8, 2010 Tested what ? It was my database that crashed the programs - how can I test to see what is wrong ??
Lee Smith Posted July 8, 2010 Posted July 8, 2010 sorry, I meant that I tested the calculation. If you want the file test, then Attach it to a Reply. Lee
Lee Smith Posted July 8, 2010 Posted July 8, 2010 It openned right up for me. What am I suppose to check for?
Madwolfie Posted July 8, 2010 Author Posted July 8, 2010 What ? I loaded FM8.5 then FM 9.0 and it crashed both - admittedly I was using the trial versions :-)
Madwolfie Posted July 8, 2010 Author Posted July 8, 2010 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 .....
Lee Smith Posted July 8, 2010 Posted July 8, 2010 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
Madwolfie Posted July 8, 2010 Author Posted July 8, 2010 Hi Yes [email protected] - I am on now. The 'no star' entry returns a zero - use the Line Entry layout to see the zero
Raybaudi Posted July 8, 2010 Posted July 8, 2010 If ( STARS ; TextSize ( Substitute ( 10 ^ STARS - 1 ; 9 ; "*" ) ; 18 ) )
Madwolfie Posted July 8, 2010 Author Posted July 8, 2010 WOW ! You are a star :-)) Thanks - very subtle changes there - like it - not sure I understand completely but it is elegant
Raybaudi Posted July 8, 2010 Posted July 8, 2010 BTW: why so many ( and unnecessary ) UNSTORED calculations ?
Madwolfie Posted July 9, 2010 Author Posted July 9, 2010 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.
Madwolfie Posted July 9, 2010 Author Posted July 9, 2010 Would be great to learn some more :-) Why are they unnecessary and why should they be stored ??
Raybaudi Posted July 9, 2010 Posted July 9, 2010 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.
Madwolfie Posted July 10, 2010 Author Posted July 10, 2010 (edited) 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 July 10, 2010 by Guest
Raybaudi Posted July 10, 2010 Posted July 10, 2010 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 ?
Madwolfie Posted July 10, 2010 Author Posted July 10, 2010 (edited) 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 July 10, 2010 by Guest
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now