The wild cards only apply to criteria entered for a find request. They are not used in calculations. In your boolean expression @ is just the @ symbol, there's no special wild card meaning that affects how the expression evaluates.
Not sure how you are trying to use this expression, but this would work where your @ won't"
( Left ( "as" ; 1 ) = "a" ) and ( Length ( "as" ) = 2 )
Thanks PhilModJunk - made my day.
Wow - no availability of wildcards in a function? Does FMP not see a real need for this????
How could you use that in expressions without making simple use of the same as literal text into complex expressions? Seems like we'd have to escape all kinds of different wild card operators in our text expressions if we did that.
What kind of expression are you trying to set up that requires such wild cards? Usually, there's an alternative expression that can be used.
ya - I guess you are right - I was just trying my best to use the wildcard & was cinfused why it wasn't working! (coming from a VBA background)
I've done a fair amount of VBA programming for MS Access systems also. While you can use wild cards in certain parts of an SQL expression, you can't use them in boolean expressions or other calculations in any other part VBA. Using wild cards in SQL is a pretty similar concept to using them in FileMaker find criteria.
It is possible to construct a custom function that uses wild cards in a text comparison. That might be very useful for certain types of data-entry validation. That idea intrigued me, so I took a shot at it. This is what I have so far. It uses @ and # wildcards much like you would in a find request. Haven't added * capability yet as that would complicate the process by quite a bit:
//WildcardMatch ( String ; Pattern )
// String text to be matched against Pattern of text and wildcards
//Pattern text pattern that combines literal text with @ and # used as wild cards
Let ( [ Ls = Left ( String ; 1 ) ;
Lp = Left ( Pattern ; 1 ) ;
Rstring = Right ( String ; Length ( String ) - 1 ) ;
Rpattern = Right ( Pattern ; Length ( Pattern ) - 1 ) ] ;
Case ( IsEmpty ( String & Pattern ) ; True ;
( Lp = "@" ) and not IsEmpty ( Ls ) ; True and WildCardMatch ( Rstring ; Rpattern ) ;
( Lp = "#" ) and not IsEmpty ( Filter ( Ls ; 9123456780 ) ) ; True and WildCardMatch ( Rstring ; Rpattern ) ;
Lp = Ls ; True and WildCardMatch ( Rstring ; Rpattern ) ;
eh - thanks for looking at this for me -sounds doable - I am just pretty new at FMP & was reading about the wildcards as they are a tad different then in VBA. In my case the left() solution worked fine, as you suggested. Actually I not made a custom function yet - don't you need advanced version for that?
Yes, you need FileMaker Advanced to add custom functions to a file. (Once added, users with regular FileMaker can use them.)
I recommend you beg, borrow or steal the funds to upgrade to the advanced version. The script debugger alone is well worth the extra dollars (and should look fairly familiar to VBA programmers) as it can both teach you much about how scripts behave in FileMaker and also save you many many hours when figuring out why a script doesn't perform as expected.