Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 4191 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

How would I find the position of a quotation mark in a bit of text?   This calculation always returns zero, even if $text contains a quotation mark.

 

Position ( $text; """ ; 1; 1)

Posted

How would I find the position of a quotation mark in a bit of text?   This calculation always returns zero, even if $text contains a quotation mark.

 

Position ( $text; """ ; 1; 1)

 

It should work for you, Matthew.  By chance is it smart quotes in the text instead of regular quotes?

Another possibility - $text is a local variable.  How are you using it?  

Posted

Yes, $text is a local variable.  Does that matter?   How can I get around that? 

Posted

The local variable is in a script.  It contains text to be parsed, and so I'd like to know the position of quotation marks.  

Posted

In case this helps....  My overall objective is to merge template text with data stored in filemaker fields (sort of like a mail merge).  My template text contains some conditional statements that my script evaluates... similar to an IF(test; result1; result2) statement.  To parse out result1 and result2, I need to know whether the semi-colons are contained within or without quotes. If they're within quotes then it will evaluate as text. If they are not quoted then the semicolon will serve as the delimiter between result1 and result2 (just like an ordinary Filemaker IF() function)....  Sorry if that's too much information. 

Posted

No need to change anything. Your expression is correct as is.


Example:

 

Let( $text = "word1" & Quote( "quoteme" ) & "word2"; List( $text; Position( $text; """; 1;1)))

 

Result:

 

 

word1"quoteme"word2
6
Posted

OK.  I think my solution was adding curly quotes.  I couldn't really tell with the my font.  

 

I guess that will take care of it. 

Posted

Don't forget about the code and char functions.

Char(8220) is the left double curly quote and char(8221) is the right double curly quote.

Posted

Thanks for the tips, both of you.  The curly quotes definitely threw me off, and I also didn't know about the Char() function.  

 

It turns out I was making things too difficult  (as is often the case).   The simpler approach is to pass tagged text to the Evaluate() function, and let filemaker parse out the quote marks and semicolons.  (Apparently 'Evaluate()' doesn't care about curly vs. straight quotes).   I'm letting users create their own text templates, which they can then merge with data fields. For example, text is entered into the 'template' field looking something like this (with additional data fields 'Gender' and 'LastName').

 

Dear << IF (Gender = "male"; "Mr."; "Ms.") >> <<LastName>>,

 

My script simply passes everything between the tags << >> to the Evaluate() function and then substitutes the result in place of the tagged text. 

Posted

My prediction is that a near-future version of FileMaker ( the next version?) will allow us to use the calculation directly on layouts, just like we can now insert Get ( flag ) functions.

 

You can sort of already do this using a self-defining conditionally formatted merge variable, but there are some refreshing and multi-window issues.

Posted

David, 

Use of calculations on layouts  would be an interesting feature.  For my purpose though, I want the user to be able to create their own merge templates, without having to go into layout mode or be given admin privileges to the database. 

Posted

You know you don't need a script, you can use a calculation field. Whatever logic your script is using, you can put into a custom function ( for ease of updating ). You have your Merge Template field and your Merge Result calculation (or auto-enter calc).

This topic is 4191 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.