Dirty May Geplaatst: 2 april 2008 Delen Geplaatst: 2 april 2008 (aangepast) 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 ) ) ) ) 2 april 2008 aangepast door Gast Quote Link naar reactie
0 Dirty May Geplaatst: 2 april 2008 Auteur Delen Geplaatst: 2 april 2008 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. Quote Link naar reactie
0 JeanWM Geplaatst: 3 april 2008 Delen Geplaatst: 3 april 2008 Kun je even een bestandje posten waar we het geheel in actie kunnen zien ? Quote Link naar reactie
0 Dirty May Geplaatst: 3 april 2008 Auteur Delen Geplaatst: 3 april 2008 Hier is 't. Ik heb 't zeer basic gehouden. Veronderstel dat dat genoeg is. GetalInTekstBestand.fp7 Quote Link naar reactie
0 JeanWM Geplaatst: 4 april 2008 Delen Geplaatst: 4 april 2008 Ik bedoelde eigenlijk een voorbeeld bestand waar je functie in verwerkt zit.... Quote Link naar reactie
0 Dirty May Geplaatst: 4 april 2008 Auteur Delen Geplaatst: 4 april 2008 Is dit niet oké ? Je kan hier toch perfect zien en uitproberen wat er aan de hand is ? Maar wellicht begrijp ik je verkeerd. Mijn excuses dan. Quote Link naar reactie
0 JeanWM Geplaatst: 4 april 2008 Delen Geplaatst: 4 april 2008 Ik had eigenlijk gehoopt om ...om tekst een kleur te geven in functie van deze of gene voorwaarde. in praktijk te zien..... Quote Link naar reactie
0 Dirty May Geplaatst: 4 april 2008 Auteur Delen Geplaatst: 4 april 2008 Ah ! ... Capito i Komt eraan. Maar wellicht zal dat pas morgen of zondag zijn. Quote Link naar reactie
0 Dirty May Geplaatst: 6 april 2008 Auteur Delen Geplaatst: 6 april 2008 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 Quote Link naar reactie
Vraag
Dirty May
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 ) ) ) )
aangepast door GastLink naar reactie
8 antwoorden op deze vraag
Aanbevolen berichten
Doe mee aan dit gesprek
Je kunt dit nu plaatsen en later registreren. Indien je reeds een account hebt, log dan nu in om het bericht te plaatsen met je account.