Tom Elliott
Members
Posts
14 
Joined

Last visited
Profile Information

Gender
Not Telling
Tom Elliott's Achievements

Any way to Get (Current Year)?
Tom Elliott replied to geraldh's topic in Calculation Engine (Define Fields)
Year ( Get ( CurrentDate ) ) will give you the current year 
Correct this FMP6 random record script ...
Tom Elliott replied to Diana, Cda's topic in Script Workspace and Script Triggers
Do you mean that when you click the Specify button, all the options are unavailable? If so, then this implies RandomField is a calc (or Summary) field  change it to Number; if not, then click the Replace with calculated result option and enter Random. 
I believe the following Custom Function will do what you require but my testing has been minimal //SubstituteBetweenTags ( theText ; startTag ; endTag ; searchString ; replaceString ) Let ([ startPos = Position ( theText ; startTag ; 1 ; 1 ) ; startLength = Length ( startTag ) ; endPos = Position ( theText ; endTag ; startPos ; 1 ) ; searchPos = Position ( theText ; searchString ; startPos + startLength ; 1 ) ; searchLength = Length ( searchString ) ; replaceLength = Length ( searchString ) ; theRest = Replace ( theText ; 1 ; endPos + Length ( endTag ) ; "" ) ] ; Case ( startPos = 0 or endPos = 0 ; theText ; searchPos = 0 or searchPos + searchLength ≥ endPos ; Left ( theText ; endPos + Length ( endTag ) ) & SubstituteBetweenTags ( theRest ; startTag ; endTag ; searchString ; replaceString) ; SubstituteBetweenTags ( Replace ( theText ; searchPos ; searchLength ; replaceString ) ; startTag ; endTag ; searchString ; replaceString ) ) )
 17 replies

 sustitute
 occurrences

(and 1 more)
Tagged with:

Substituting numbers in a text field
Tom Elliott replied to Scott1981's topic in Calculation Engine (Define Fields)
Thanks for picking that up, and for the correction [although I'd prefer IsEmpty ( char8 )] 
Substituting numbers in a text field
Tom Elliott replied to Scott1981's topic in Calculation Engine (Define Fields)
I believe the following Custom Function may be what you require, however as others have noted, 14digit numbers (and indeed any longer number with a multiple of 7 digits) could be treated in one of two ways; this CF does NOT replace 14digit numbers with "X"s ReplaceSevenDigitNumbers ( theText ) = Let ([ left7 = Left ( theText ; 7 ) ; left14 = Left ( theText ; 14 ) ; char8 = Middle ( theText ; 8 ; 1 ) ; sevenDigits = ( left7 = Filter ( left7 ; "012345x6789" ) ) ; exactlySevenDigits = sevenDigits and ( char8 ≠ Filter ( char8 ; "0123456789" ) ) ; fourteenDigits = ( left14 = Filter ( left14 ; "0123456789" ) ) ] ; Case ( Length ( theText ) < 7 ; theText ; exactlySevenDigits ; "XXXXXXX" & replaceSevenDigitNumbers ( Replace ( theText ; 1 ; 7 ; "" ) ) ; fourteenDigits ; Left ( theText ; 6 ) & replaceSevenDigitNumbers ( Replace ( theText ; 1 ; 6 ; "" ) ) ; sevenDigits ; left7 & ReplaceSevenDigitNumbers ( Replace ( theText ; 1 ; 7 ; "" ) ) ; Left ( theText ; 1 ) & ReplaceSevenDigitNumbers ( Replace ( theText ; 1 ; 1 ; "" ) ) ) ) @LaRetta: Using your CF, any number with 7 or more digits will have its first 7n digits replaced by "X's, where n= Div (number of digits ; 7), e.g. Mask ( "123456789" ) returns "XXXXXXX89" cheers Tom 
With overlapping time ranges, calculate "net" time
Tom Elliott replied to Alex Taylor's topic in The Left Brain
Ok, try again. I really think I've got it this time  with the proviso that unreasonable time log entries are likely to lead to an unreasonable 'net time' for the job  but as always I'm ready to be shown the error of my ways OverlappingTimes_Demo_v4.fp7.zip 10 replies

 calculation
 time

(and 4 more)
Tagged with:

With overlapping time ranges, calculate "net" time
Tom Elliott replied to Alex Taylor's topic in The Left Brain
Yes, I figured that out for myself shortly after posting. Ah, well 10 replies

 calculation
 time

(and 4 more)
Tagged with:

With overlapping time ranges, calculate "net" time
Tom Elliott replied to Alex Taylor's topic in The Left Brain
Well .. how about .. OverlappingTimes_Demo_v3.fp7.zip 10 replies

 calculation
 time

(and 4 more)
Tagged with:

With overlapping time ranges, calculate "net" time
Tom Elliott replied to Alex Taylor's topic in The Left Brain
I think the attached does what you want cheers Tom Ooops  forgot to attach file! OverlappingTimes_Demo_v2.fp7.zip 10 replies

 calculation
 time

(and 4 more)
Tagged with:

Hi Daniele The way you had it, the first substitution looks for "1" in your string and if it finds it replaces it with some number which depends on start, but has got to be at least 1, let's suppose it is in fact 2; the the next substitution looks for "2"in your string, but now there may be two 2's in the string  the original one and the one that the first substitution put there, so they both get replaced by 3, and so it goes on for all the following substitutions. This is not what you want. By reversing the order of substitutions, you don't have this problem because each replacement value is at least as great as the number it is replacing and, therefore, greater than the search value for each of the following substitutions cheers Tom

Daniele It's not the SerialIncrement that's the problem, it's the Substitute Try reversing the order of the substitutions: ; [ 9 ; ¶ & SerialIncrement ( start ; 9 ) ] ; [ 8 ; ¶ & SerialIncrement ( start ; 8 ) ] ; [ 7 ; ¶ & SerialIncrement ( start ; 7 ) ] ; [ 6 ; ¶ & SerialIncrement ( start ; 6 ) ] ; [ 5 ; ¶ & SerialIncrement ( start ; 5 ) ] ; [ 4 ; ¶ & SerialIncrement ( start ; 4 ) ] ; [ 3 ; ¶ & SerialIncrement ( start ; 3 ) ] ; [ 2 ; ¶ & SerialIncrement ( start ; 2 ) ] ; [ 1 ; ¶ & SerialIncrement ( start ; 1 ) ]

understand & real world use of extend function
Tom Elliott replied to imoree's topic in Calculation Engine (Define Fields)
I'm not sure what you're trying to achieve but I think all you need to do is change your script to the single step Set Field [ NAME::labels; Get ( ActiveRepetitionNumber ) ] 
It scrubbing time :) Need help with parsing
Tom Elliott replied to Drew Sanderson's topic in Importing & Exporting
How about: Filter ( StockNumber ; "abcdefghijklmnopqrstuvwxyz" )