MikeVM Posted March 6, 2009 Share Posted March 6, 2009 Hi Techsupport, I stuck with one (looks so simple!) rule: I have several formatted text resources - Intro_1, Intro_2, Intro_3 - which is printed depends on field "option" Each resource could be printed in two colors - color1 or color 2, depending on value of field "color". So I right a rule like this: if (Field("Color") == "color1") { if (Field("option") == "Option 1") return '<color name="color1">' Resource("Intro_1"); if (Field("option") == "Option 2") return '<color name="color1">' + Resource("Intro_2"); } if (Field("Color") == "color2") { if (Field("option") == "Option 1") return '<color name="color2">' Resource("Intro_1"); if (Field("option") == "Option 2") return '<color name="color2">' + Resource("Intro_2"); } What is happen - instead of getting content of the Resource everything I get just line: Resource("Intro_1") What I did wrong? Link to comment Share on other sites More sharing options...
Dan Korn Posted March 9, 2009 Share Posted March 9, 2009 What is happen - instead of getting content of the Resource everything I get just line: Resource("Intro_1") What I did wrong? You need to use the content property of the FusionProResource object, like so: return '<color name="color1">' + Resource("Intro_1").content; If you're simply returning a resource from a rule, then even though the return value shown when you click "Validate" in the Rule Editor dialog is something like Resource("Intro_1"), the composition engine see that it's actually an object and uses its contents. However, if you append or prepend any text (string) to the object, then the entire return value becomes a string, and the FusionProResource object simply gets converted to Resource("name"), as part of a string containing other stuff, and there's no way to "un-stringify" it. Using the content property adds the actual content (markup) of the resource to the return value. Link to comment Share on other sites More sharing options...
MikeVM Posted March 9, 2009 Author Share Posted March 9, 2009 Thank you Dan. I had some thoughts it's somehow connected to color tag. Link to comment Share on other sites More sharing options...
MikeVM Posted March 10, 2009 Author Share Posted March 10, 2009 I have another related question... It seems like rule works correctly, but when trying to preview template locally (on local computer) I do not see any color change whatever I enter in color tag. Text's always seen as black. This is does not look like correct preview... Any suggestions? TIA Link to comment Share on other sites More sharing options...
Dan Korn Posted March 10, 2009 Share Posted March 10, 2009 I have another related question... It seems like rule works correctly, but when trying to preview template locally (on local computer) I do not see any color change whatever I enter in color tag. Text's always seen as black. This is does not look like correct preview... Any suggestions? Try doing a full composition (not just a Preview) and look in the log (.msg) file. Link to comment Share on other sites More sharing options...
MikeVM Posted March 10, 2009 Author Share Posted March 10, 2009 Thanks, I will try later Link to comment Share on other sites More sharing options...
MikeVM Posted March 19, 2009 Author Share Posted March 19, 2009 Hi Dan, sorry, but this is not working. I use the following rule: return '<color name="' +Rule("colorname")+ '">' + Resource(Field("company")).content; colorname - changing between white and black, depending on other field. Resource (Field("company")) - formatted text, typed in Resource editor and specific for every "company". In editor it's not set "override running paragraph formatting". So whatever colorname is choosen, rule always return black text in 8.5 point size, however it should change color and be at least 12.5 pt. Any help?? Link to comment Share on other sites More sharing options...
Dan Korn Posted March 19, 2009 Share Posted March 19, 2009 colorname - changing between white and black, depending on other field. Resource (Field("company")) - formatted text, typed in Resource editor and specific for every "company". In editor it's not set "override running paragraph formatting". So whatever colorname is choosen, rule always return black text in 8.5 point size, however it should change color and be at least 12.5 pt. Try this: return '<span color="' + Rule("colorname")+ '">' + '<magnify factor=100 type=pointsize min=12.5>' + Resource(Field("company")).content; Link to comment Share on other sites More sharing options...
MikeVM Posted March 20, 2009 Author Share Posted March 20, 2009 Great! Works perfectly. Thank you so much! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.