Brian Dunning's FileMaker Custom Functions

CF.TurnIt ( ValueToTurn ; YearLength )

This function turns a date or a timestamp or turns back a turned date or a turned timestamp.

  Average rating: 4.5 (30 votes) Log in to vote

Thomas Hellwig   Thomas Hellwig
DELASOCIAL
http://www.delasocial.com

Share on Facebook Share on Twitter

  Sample input:
CF.TurnIt ( "30.07.2014 21:29:55" ; 2 )
  Sample output:
140730_212955

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

This function inverts a date or a timestamp or inverts back an inverted date or an inverted timestamp. It also compresses a time of day (clock time). A date or a timestamp wich is inverted, results in a textstring that for example can be used to term folders or files. Subsequently you can sort your folders or files easily by (the inverted) date or timestamp.

Comment:
Time in a timestamp will not be inverted in order to maintain the possibility of sorting (folders or files) by date and time correctly. Timestamp format is "DD.MM.YYYY hh:mm:ss" (24-hour count notification). The delimiter between date and time of a turned timestamp is "_".

Operation codes are: (In version 1.0 there was a second parameter called "OperationCode". I removed that parameter and adapted the function to identify the ValueToTurn string by itself. So now the CF reads the ValueToTurn parameter and inverts the value as you desire.)

 

Comments

Tjebbe van Tijen   Tjebbe van Tijen, Amsterdam
Jun 23, 2015
I do get constant errors, which seem to be some comments passing like data


It occurs at line 42

with the string SetzeVars

I do get the message "This function can not be found"

Could you post agian a corrected version... I would be helped.

thnaks



//############################################################################################

SetzeVars ( //--- Top
[
VTT = ValueToTurn ;
ERR = "Wrong Value" ;
R6TTS = ZeichenRechts ( VTT ; 6 ) ;
CT = Falls ( R6TTS < 240000 UND ZeichenRechts ( R6TTS ; 4 ) < 6000 UND ZeichenRechts ( R6TTS ; 2 ) < 60 ; 1 ; 0 ) ;
OperationCode = Falls ( LiesAlsDatum ( VTT ) = VTT ; 1 ; Länge ( VTT ) = 8 UND LiesAlsZahl ( VTT ) = VTT ; 2 ; LiesAlsZeitstempel ( VTT ) = VTT ; 3 ; Länge ( VTT ) = 15 UND LiesAlsZahl ( ZeichenLinks ( VTT ; 8 ) ) = ZeichenLinks ( VTT ; 8 ) UND CT = 1 UND MusterAnzahl ( VTT ; "_" ) = 1 ; 4 ; 0 )
] ;
 
Thomas Hellwig   Thomas Hellwig, Hamburg
Jun 23, 2015
Hello!
Look at the head info:
___ Code language: German
___ FMP version: 12

The function name "SetzeVars" (http://www.filemaker.com/de/help/html/func_ref3.33.15.html) is correct, but in FM 13 it is "SetzeVar" (http://www.filemaker.com/help/13/fmp/de/html/func_ref3.33.16.html).
 
Tjebbe van Tijen   Tjebbe van Tijen, Amsterdam
Jun 23, 2015
Thank you for quick reactions... sadly I am still using Filemaker Pro 11 (Advanced) would it work (with some adaption in that application at all?

schöne Grüsse

tjebbe
 
Thomas Hellwig   Thomas Hellwig, Hamburg
Jun 23, 2015
I think it will work with FM 11. You can chance the language of FM with a tool called Language Switcher (Mac). The code will be automatically translated.

Hope that it helps you!
 
Thomas Hellwig   Thomas Hellwig, Hamburg
Jun 23, 2015
New version uploaded!
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Under construction. Email me your wish list for improvements.