Jump to content
  • 0

Getallen kleuren in functie van


Dirty May

Question

Posted (edited)

Filemaker voorziet om tekst een kleur te geven in functie van deze of gene voorwaarde.

Helaas is dat niet van toepassing voor getallen. Niet zo begrijpelijk waarom niet.

Maar goed, dan maar zelf iets in eengeknutseld.

 

Wel er bij zeggen dat standaard de (Europese) interpunctie toegepast wordt.

 

De gebruikte Functieparameters zijn Getal en Aantal decimalen.

 

Wie van oordeel is dat dit beter kan, of korter, mag zich gerust laten horen.

Altijd blij wat bij te leren.

 

 

[ Erratum : wie voor 02-04-2008 18:51 dit heeft gekopieerd, heeft een foute versie bij negatieve getallen. Mijn excuses hiervoor. ]

 

 

If ( Left ( Getal ; 1 ) = "-" ; "-" ; "" ) &

 

Case (

 

Length ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ) > 15 ;

Middle ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ; 1 ; Length ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ) - 15 ) & "." &

Middle ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ; Length ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ) - 14 ; 3 ) & "." &

Middle ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ; Length ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ) - 11 ; 3 ) & "." &

Middle ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ; Length ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ) - 8 ; 3 ) & "." &

Middle ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ; Length ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ) - 5 ; 3 ) & "." &

Middle ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ; Length ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ) - 2 ; 3 ) ;

 

Length ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ) > 12 ;

Middle ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ; 1 ; Length ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ) - 12 ) & "." &

Middle ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ; Length ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ) - 11 ; 3 ) & "." &

Middle ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ; Length ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ) - 8 ; 3 ) & "." &

Middle ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ; Length ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ) - 5 ; 3 ) & "." &

Middle ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ; Length ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ) - 2 ; 3 ) ;

 

Length ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ) > 9 ;

Middle ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ; 1 ; Length ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ) - 9 ) & "." &

Middle ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ; Length ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ) - 8 ; 3 ) & "." &

Middle ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ; Length ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ) - 5 ; 3 ) & "." &

Middle ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ; Length ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ) - 2 ; 3 ) ;

 

Length ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ) > 6 ;

Middle ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ; 1 ; Length ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ) - 6 ) & "." &

Middle ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ; Length ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ) - 5 ; 3 ) & "." &

Middle ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ; Length ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ) - 2 ; 3 ) ;

 

 

Length ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ) > 3 ;

Middle ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ; 1 ; Length ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ) - 3 ) & "." &

Middle ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ; Length ( Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) ) - 2 ; 3 ) ;

 

Truncate ( Round ( Filter ( Getal; "0123456789," ) ; Aantal decimalen ) ; 0 ) )

 

& If ( Aantal decimalen ≠ 0 ; "," ; "" )

 

& Right ( Truncate ( Round ( Getal ; Aantal decimalen ) ; Aantal decimalen ) ;

 

Length ( Truncate ( Round ( Getal ; Aantal decimalen ) ; Aantal decimalen ) ) -

 

If ( Position ( Truncate ( Round ( Getal ; Aantal decimalen ) ; Aantal decimalen ) ; "," ; 1 ; 1 ) = 0 ;

 

Length ( Truncate ( Round ( Getal ; Aantal decimalen ) ; Aantal decimalen ) ) ; Position ( Truncate ( Round ( Getal ; Aantal decimalen ) ; Aantal decimalen ) ; "," ; 1 ; 1 ) ) )

 

& Right ( 10 ^ Aantal decimalen ;

 

Aantal decimalen -

 

( Length ( Truncate ( Round ( Getal ; Aantal decimalen ) ; Aantal decimalen ) ) -

 

If ( Position ( Truncate ( Round ( Getal ; Aantal decimalen ) ; Aantal decimalen ) ; "," ; 1 ; 1 ) = 0 ;

 

Length ( Truncate ( Round ( Getal ; Aantal decimalen ) ; Aantal decimalen ) ) ; Position ( Truncate ( Round ( Getal ; Aantal decimalen ) ; Aantal decimalen ) ; "," ; 1 ; 1 ) ) ) )

Edited by Guest

8 answers to this question

Recommended Posts

  • 0
Posted

Bij het verder testen van deze functie stoot ik echter op een moeilijk oplosbaar probleem.

 

Wanneer er een reeks van 9 aaneengesloten nullen net voor

de komma komen te staan, dan krijg ik, let echter wel, in de getekste versie,

een rare notatie tegen, waarschijnlijk wordt ergens diep in de coding

met wetenschappelijke notaties gewerkt.

Vandaar waarschijnlijk dit uitzicht.

 

70.000.000.000,006 wordt : 7.,0e.+10,0e+10

 

Als ik evenwel tussen al die nullen 1 niet-nul zet, dan wordt het :

 

700.000.000.001,006 wordt : 700.000.000.001,006

 

Onthoudt hierbij : links is het oorspronkelijke getal, rechts is tekst !

 

Een ander voorbeeld, zonder cijfers na de komma :

 

1.230.000.000.000 wordt : 1,.23e.+1223e+12

 

Maar zet ik een niet-nul, net voor de komma bijvoorbeeld, dan doe ik wat ik wil :

 

12.300.000.000.000.001 wordt netjes 12.300.000.000.000.001

 

Iemand enig idee hoe dat kan voorkomen worden ?

 

Ik heb ondertussen gepoogd om elke Functieparameter Getal te vervangen

door GetAsText ( Getal ). Dit helpt in ieder geval niet.

  • 0
Posted

Geen kritiek op de layout aub.

ik heb daar in dit geval niet

de minste aandacht aan besteed.

In absolute tegenstelling tot anders.

 

Hier is het doel het illustreren van een mechanisme.

En hopelijk komt het deze keer wel tegemoet aan je verwachting, Jean.

 

Je kan er in ieder geval mee experimenteren.

GetalInTekstBestand.fp7

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...