I think you are referring to your answer here:
Beverly Voth wrote:
Think of is as a "mail-merge", but you use the Substitute function to supply the real values that replace the "<<...>>" merge-type values inside the chuck of text.
Yes, you can use "Let". It more or less a way to create the entire html/js/css as a block of text. And you put placeholders (the merge-style text) inside where they need to be.
Can you elaborate on this process? I am not quite following. It sounds like something like this:
Am I on the right track? Reading your notes, it seems like I put the temporary variables inside of arrows like this << temp variable >>, but how do I tell my calcuation to replace those with my fields?
Edit - I think I need to read up on the Substitue function in filemaker.
Yes, set "placeholders". I used the "<<...>>" but any symbols that you can call from the Substitute function will work. But if you happen to be using the double angle brackets in any of your code in the field, you need to use character(s) that you happen to NOT be already using. Other suggestions might be "__....__" (double underscore) or "..." tilde at the front and back.
code code code <<field1>> code code code <<field2>> code
code code <<field2>> code code <<field3>> ....
Substitute ( mycode ; "<<field1>>" ; table::field 1 ) // one field replaced if you prefer to do this in script with "steps".
Substitute ( mycode ; [ "<<field1>>" ; table::field 1 ] ; [ "<<field2>>" ; table::field2 ] ; .... ) // repeat as needed for each pair to find/replace.
Check the Substitute help topic for how this function works for multiple parameters. You should know that if you set the same placeholder in the code field in more than one spot, ONE substitute will replace all matches.
Gah I always forget to click "mark this as a question"!
Thank you very much that is exactly what I needed.
Edit - now that I think about it, this will still have some issues - for example: if I want to do mathmatical expressions in my code, I wont be able to do this:
if ( <<field1>> + 5 = 10)
Edit - I guess it might work when filemaker's webviewer actually executes the script, but I will still have to work with 2 seperate peices of code, meaning I will have to go through and edit all the text when I put it into filemaker I was hoping to just manage it one time in my external IDE, and then when ready to go just paste it into my text field and be done.
Edit Edit - I suppose I can still use my external IDE for formatting and readability reasons and then copy and paste. I will just get a lot of errors as I am typing it up, and I wont be able to debug correctly, which is one of the main reasons I was hoping to use an IDE. I would be open to any other ideas, but if this is the best option I suppose it can work. At least its better than manually typing it into the calc field!