Jump to content

Using a quote in a calculation


 Share

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

Recommended Posts

Hello,

I am using FMP to generate an HTML page using data from fields to fill in paramters and image names. Although most browsers are forgiving and do not requite the quotes areound parameters I do like to follow the HTML spec by using them. FMP will not allow nested quotation marks, so my question is: how do I get a calculation to output concatented text and field data with quotes in it (example: <td height="25" align="center" valign="top">).

Thank you,

Robert

TMR Design

FileMaker Version: 6

Platform: Mac OS X Panther

Link to comment
Share on other sites

To output quote marks in a FileMaker text calculation you need to add a few extras, since quote marks around text are used to signify that it is text, but are not output as such:

"<td width=""20"">"

It's a black art to get the right number everywhere the first try, but FileMaker will generally tell you if you don't, and you can see the result. Alternatively you can create a global field and put a quote mark in it, or a calculation file on its own. If it's named "q" then:

"<td width=" & q & "20" & q & ">"

is equivalent; but not really any easier in this case.

Link to comment
Share on other sites

Thanks for the reply. Now here is another related question

In the process of assembling fields and text to build the HTML code to output I find that I can't concatenate using calculation fields. How do I get around that?

Example: There is a calculation field named 'image_name'. That field takes a Compact Disc namefrom field 'cd_name' and adds either .jpg or.gif depending on a radio button selection in 'image_format', thus returning something like 'favorite_cd.gif' in 'image_name'.

Now if I want to build that into a string of code but can't. I have a field named 'html_output' and it is supposed to be made up of a string of code pre-entered joined with 'image_name' like this:

<td width="20" align="center"><img src=" & image_name & "></td>

but this does not work because image_name is a calculation.

How do I get around this?

Thank you,

Robert

Link to comment
Share on other sites

Use this formula:

"<td width=""20"" align=""center""><img src=""" & image_name & """></td>"

or store a double quote character in a global field called gQ and then use this formula:

"<td width="&gQ&"20"&gQ&" align="&gQ&"center"&gQ&"><img src="&gQ& & image_name & &gQ&"></td>"

Or a third option. Store the text that is to the left of image_name in a global gLeftPart, and the text that is to the right of image_name in a global called gRightPart, and then use this formula:

gLeftPart & image_name & gRightPart

where gLeftPart contains:

<td width="20" align="center"><img src="

and gRightPart contains:

"></td>

Link to comment
Share on other sites

This topic is 6486 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
 Share

×
×
  • Create New...

Important Information

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