designerspressinc Posted June 15, 2012 Share Posted June 15, 2012 This is the line I am having problems with: V: «Office Phone» FX:«Fax» M:«Mobile Phone» I want to hide the label for mobile and fax if they are not used. I have tried the "hide phone number label" rule and can get it to work for the fax number but when I set up the second rule for Mobile, it doesn't work. Here is what I am using: if (Field("Fax") == "") return ""; else return 'FX: '+Field("Fax"); -----and----- if (Field("Mobile Phone") == "") return ""; else return 'M: '+Field("Mobile Phone"); When I validate each, they seem to work but when I compose it doesn't add the M: for the Mobile. Help please. Fusion Pro Designer 6.0P1e - OS X 10.6.8 Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted June 15, 2012 Share Posted June 15, 2012 Are you actually calling out the rule, by name, in your text frame? Quote Link to comment Share on other sites More sharing options...
designerspressinc Posted June 15, 2012 Author Share Posted June 15, 2012 Sorry. I don't know what that means. I have been thrown into this fairly ignorant of how to do most of it. I had Fusion Pro training 2 years ago but only now am I starting to use it. I learn quickly so if you can explain more about what you are asking, I will do my best to answer. Thanks, Robert Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted June 15, 2012 Share Posted June 15, 2012 Sorry. I don't know what that means. I have been thrown into this fairly ignorant of how to do most of it. I had Fusion Pro training 2 years ago but only now am I starting to use it. I learn quickly so if you can explain more about what you are asking, I will do my best to answer. Simply creating a JavaScript rule doesn't change anything at all in your output. You need to actually call out the rule in a text frame for it to have an effect. This is what you want to do: Double-click on the text frame to bring up the Variable Text Editor dialog. Select the "M:«Mobile Phone»" text. In the Variables drop-down list, select the variable with the same name as the rule you created. Click Insert to add the variable to the text, replacing the existing text. If that doesn't help, you might want to go back and familiarize yourself with some of the basics of using the product. You could also collect up the job and post it here for someone to take a look at. Quote Link to comment Share on other sites More sharing options...
designerspressinc Posted June 15, 2012 Author Share Posted June 15, 2012 Thanks! That sorta worked. Now I need to get it to take away the extra spaces that are left between the different numbers when it removes them... or do I need to ADD those spaces in the rule rather than the variable frame? Thanks, Robert Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted June 15, 2012 Share Posted June 15, 2012 Now I need to get it to take away the extra spaces that are left between the different numbers when it removes them... or do I need to ADD those spaces in the rule rather than the variable frame? I would replace all of the text with a single, more generalized rule, like so: var labels = { V: Field("Office Phone"), FX: Field("Fax"), M: Field("Mobile Phone"), }; var result = []; for (var l in labels) if (labels[l]) result.push(l + ": " + labels[l]); return result.join(" "); Quote Link to comment Share on other sites More sharing options...
designerspressinc Posted June 15, 2012 Author Share Posted June 15, 2012 First of all, thanks for the help. Sadly that last bit is still sorta over my head but I will attack it on Monday and see what I can make of it. Can I just copy that code and sub my variables? Thanks, Robert Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted June 15, 2012 Share Posted June 15, 2012 Sadly that last bit is still sorta over my head but I will attack it on Monday and see what I can make of it. Can I just copy that code and sub my variables? Yes, although I tried to include the same variable names as in your example so that you don't have to modify it at all. Quote Link to comment Share on other sites More sharing options...
designerspressinc Posted June 18, 2012 Author Share Posted June 18, 2012 Thanks again for your help. We're getting there. I tried using your code "as is" and it pretty much worked but I need to get 2 spaces between each number/label when they are used. I looked at the code but could not guess where to add that. V: 455-555-5555 FX: 234-234-2252 M: 343-343-2222 IF I can can figure that out, or you can show me, I can probably figure out the code to do the next thing I need to do (address line for the same card). 9205 SouthPark Center Loop | Suite 400 | Orlando, FL 32819 Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted June 18, 2012 Share Posted June 18, 2012 Thanks again for your help. We're getting there. I tried using your code "as is" and it pretty much worked but I need to get 2 spaces between each number/label when they are used. I looked at the code but could not guess where to add that. V: 455-555-5555 FX: 234-234-2252 M: 343-343-2222 Change the last line to: return result.join(" ");With two spaces between the quotes. IF I can can figure that out, or you can show me, I can probably figure out the code to do the next thing I need to do (address line for the same card). 9205 SouthPark Center Loop | Suite 400 | Orlando, FL 32819 Something like this: var result = []; var fields = [Field("Add1"), Field("Add2"), Field("City") + ", " + Field("State") + Field("Zip")]; for (f in fields) if (fields[f]) result.push(fields[f]); return result.join(" | "); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.