Inline <<fields>>
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Inline <<fields>>
Hi,
I'm new to RR, do a bit of Perl, HTML and Filemaker.
I have a Filemaker application and am considering converting this to RR and an SQL database. In order to teach myself about RunRev I've decided to try to make one of the elements of my Filemaker application.
This is a contact management database which links to a database containing all of the letters and other communications we have with a client. The letters are in effect form letters and use "merge fields" which allow for a letter to pull in name, address, date and other relevant information.
I can't find reference to this type of templating or substitution in RunRev. Is there an easy way to do it. In Perl I would use TemplateToolkit or a here doc with the variables inline.
I know that Quartam Reports might be a solution is there a simple way to do variable substitution in RunRev?
Thanks
Phil
I'm new to RR, do a bit of Perl, HTML and Filemaker.
I have a Filemaker application and am considering converting this to RR and an SQL database. In order to teach myself about RunRev I've decided to try to make one of the elements of my Filemaker application.
This is a contact management database which links to a database containing all of the letters and other communications we have with a client. The letters are in effect form letters and use "merge fields" which allow for a letter to pull in name, address, date and other relevant information.
I can't find reference to this type of templating or substitution in RunRev. Is there an easy way to do it. In Perl I would use TemplateToolkit or a here doc with the variables inline.
I know that Quartam Reports might be a solution is there a simple way to do variable substitution in RunRev?
Thanks
Phil
Hi Phil,
Since Revolution isn't only a database system but much more a programming environment, you need to make such a system yourself. Usually, I take a text and add a few unique place holders (<<fieldname>>, or simply ***), and use the replaceText function or the replace command to replace the place holders with the text I need.
Best,
Mark
Since Revolution isn't only a database system but much more a programming environment, you need to make such a system yourself. Usually, I take a text and add a few unique place holders (<<fieldname>>, or simply ***), and use the replaceText function or the replace command to replace the place holders with the text I need.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
That's what I was about to say, but there's also a great series of articles about using "merge" by Jan Schenkel in the RevUp Newsletter issues:
http://runrev.com/newsletter/august/iss ... etter2.php
http://www.runrev.com/newsletter/novemb ... etter3.php
http://www.runrev.com/newsletter/decemb ... etter3.php
http://runrev.com/newsletter/august/iss ... etter2.php
http://www.runrev.com/newsletter/novemb ... etter3.php
http://www.runrev.com/newsletter/decemb ... etter3.php
Hi,
Thanks for the prompt replies.
If you read the docs for the Perl modules that do templating such as TemplateToolkit and HTML::Template they all say that "everyone has tried to make their own Perl templating system using a variable replace at some time or other ...". They then go on to tell you that there is no need to start from scratch etc.
I thought that the same might be the case with Runtime Revolution. Off to write my own replace function.
Cheers
Phil
Thanks for the prompt replies.
If you read the docs for the Perl modules that do templating such as TemplateToolkit and HTML::Template they all say that "everyone has tried to make their own Perl templating system using a variable replace at some time or other ...". They then go on to tell you that there is no need to start from scratch etc.
I thought that the same might be the case with Runtime Revolution. Off to write my own replace function.
Cheers
Phil
-
- VIP Livecode Opensource Backer
- Posts: 10049
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Before you write your own, do take a look at the merge function. It's quite powerful, and makes shortwork of doing a lot of replacements in a template.
You may find many ways to augment that with your own scripts, but speaking as someone who makes a big part of my living with tools to merge data into web templates (my WebMerge product) I can't say enough good things about the usefulness of Rev's merge function.
You may find many ways to augment that with your own scripts, but speaking as someone who makes a big part of my living with tools to merge data into web templates (my WebMerge product) I can't say enough good things about the usefulness of Rev's merge function.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Thanks for the pointer Richard.
Here's what I did:
Created 3 fields:
name
text_letter
merged
and a button to make the script go.
This is the script
on mouseUp
put merge (field "text_letter" ) into field merged
end mouseUp
This is the text:
[[field "name"]] more text.
On pressing the button the text with the contents of the "name" field merged in are placed into the "merge" field. This is the behaviour that I was looking for.
Many thanks
Phil
Here's what I did:
Created 3 fields:
name
text_letter
merged
and a button to make the script go.
This is the script
on mouseUp
put merge (field "text_letter" ) into field merged
end mouseUp
This is the text:
[[field "name"]] more text.
On pressing the button the text with the contents of the "name" field merged in are placed into the "merge" field. This is the behaviour that I was looking for.
Many thanks
Phil