Jump to content

step

Registered Users - Approved
  • Posts

    962
  • Joined

Everything posted by step

  1. make sure you have "treat returned string as tagged text" checked.
  2. Your syntax is a little off. You need quotes around your tags and you're missing a couple of plus signs. And if you want to simplify a few things, you can just use the color tags, you don't need the span tags as well: var result = '<color name ="pantone 335 C">' + Field("First name") + " " + Field("Last name") + '</color>'; result += (Field("Qualification 1") != "") ? '\n <color name = "grey">' + Field("Qualification 1") + " " + Field("Qualification 2") + '</color>' : ""; return result;
  3. You could simplify your if statements like this: var result = ""; result += (Field("First Name") != "") ? Trim(Field("First Name")) + " " : "" ; result += (Field("Middle Name") != "") ? Trim(Field("Middle Name")) + " " : "" ; result += (Field("Last Name") != "") ? Trim(Field("Last Name")) + " " : "" ; return Left(result,result.length-1); Or you could accomplish the same thing in less code using a for loop: var names = [Trim(Field("First Name")),Trim(Field("Middle Name")),Trim(Field("Last Name"))]; for (var i=0; i<3; i++) { if (names[i] == "") { names.splice(i,1); i--; } } return names.join(" ");
  4. Try using a replace function instead of a split. This way it will search the string for a "/" and replace it with a break tag. I used a regex so that it can handle multiple instances of "/" thus inserted a break tag per "/". return Field("Title 2").replace(/\//g,"<br>");
  5. Since the data was created on the Windows side, the easiest solution would be the replace any instance of ® in your data file with "®". Then replace "®" (FusionPro side) with "®" which is common between the two platforms. You might be able to interpret the windows ASC character with JavaScript with something like: return Chr(Asc("Æ")); but I'm not sure about that.
  6. Assuming you're trying to list these in one text field, this might work for you: var amt = []; for (var i=1; i<=5; i++){ (Field("Amt" + i) != "") ? amt.push(Field("Amt" + i)) : ""; } return amt.join("<br>").replace(/(\d+)/g,function(n){return FormatNumber("$###,###,###.00",n);});
  7. var s = Field("Your Field"); s.replace("and","<br>and"); return s;
  8. return "<color name=\"Red\">cell:</color> "+formatNumber(Trim(thisNumber));
  9. Both of your examples are "4.72E+16" but convert to two completely different numbers. There is not way to write logic to convert the numbers (other than using Excel) from my perspective.
  10. I assume you want the 14th digit to be a "1" also? This goes back to what I was saying about if you want the literal number you should edit the data in Excel. Do you have an example of some of the other numbers you'd like to convert and what their output should be?
  11. I think that's really something that you should convert in Excel by changing the field type to "text" rather than "number." Especially since "4.27E+16" is equal to "47200000000000000." But if you're okay with that, something like this might work for you: var s= Field("YOUR FIELD"); s = s.split("E"); return Math.pow(10,Int(s[1])) * s[0];
  12. Oh, I know why my code didn't work. It's because "Var1" is the field name not a variable called by the rule. You can update Eric's code to do what you want by replacing the last two "#"'s in his formatting rule: var amount = Field("YOUR FIELD"); var result = "$0.00"; if (amount != "0") result = "$" + FormatNumber("#,###.[color="Red"]00[/color]", amount); return result; Or you could just use the rule that Thomas posted.
  13. Convert the rule to JavaScript and replace the first line with this: var Var1 = (Field("[color="Red"]YourField[/color]") == "0") ? "0.00" : Field("[color="red"]YourField[/color]"); Make sure you edit the portions highlighted in red with the name of the field you're intending to format.
  14. Your if statement is written incorrectly. You don't need a semicolon after the argument: if (Field("QRCode") == "")[color="Red"];[/color] { var qrcode = FindGraphicFrame("QRCode"); qrcode.suppress = true; }
  15. I'm not sure why but it seems FPI uses "infinite stack" regardless of setting a stack height. Not sure if that's a FPI issue or if it's because of the records being repeated. I think the easiest solution would be to add "FPO" or "dummy" records to the end of your data file forcing your total record count to be divisible by 8. So that every position on the sheet is filled forcing FPI to generate 64 pages for every 8 records rather than evenly distributing them across the sheet when there aren't enough records to fill the imposition.
  16. Are you doing an infinite stack? Could you do a set stack count of 64?
  17. What are you trying to do with the imposition?
  18. I'd venture to guess that the problem with the imposition stems from the fact that for repeatRecordNumber 1 & 30, the template outputs 4 pages rather than the expected 2. I think you would have to set all of your pages to "unused" and rework the code to be something like: FusionPro.Composition.repeatRecordCount = 32; // 2 extra for the front and back sheets switch (FusionPro.Composition.repeatRecordNumber) { case 1: FusionPro.Composition.SetBodyPageUsage("HeaderFront",true); FusionPro.Composition.SetBodyPageUsage("HeaderBack",true); break; case 32: FusionPro.Composition.SetBodyPageUsage("PIFront",true); FusionPro.Composition.SetBodyPageUsage("PIBack",true); break; default: FusionPro.Composition.SetBodyPageUsage("OrderFront",true); FusionPro.Composition.SetBodyPageUsage("OrderBack",true); break; } Please note that I haven't tried to validate this code myself, so you may have to tinker with it to make it work the way you want but I think that's a starting point to get that worked out.
  19. Sounds like you should set up your pages at size and then impose them in FPImposer. So for example: the decals are 2" x 2" and you want them 16 up on an 8.5x11 sheet (giving you your 1-16). When you set up your FPI file, under layout, select vertical first so that the records are imported from top to bottom and then set your horizontal layout. Make sure you click the "Advanced" button and change the "Horizontal" "Ordering" to "Right to Left".
  20. Collecting the entire job as is seems more in line with issuing a FusionPro support ticket rather than starting a thread on the forum and and asking for suggestions. If you remove the confidential information from your data/template and ensure that the problem still occurs, collect it and post it to the forum for us to take a look at. Does the problem occur at composition too or just in preview?
  21. Do you have the casing correct? Capital "C", capital "L"?
  22. The CopyFit function is only valid in the OnCopyFit call back rule. I think you want to use "CopyfitLine()" instead
  23. Ah, you know what? I bet it's the comma that's throwing off the sort. I revised the replace functions on the fields to remove dollar signs AND commas: // Your fields & remove the dollar signs var a = Field("A").replace(/[\$,]/g,""); var b = Field("B").replace(/[\$,]/g,""); var c = Field("C").replace(/[\$,]/g,""); And altered the line of code that populates the table's rows to format the number back: myTable.Rows[row].SetContents(numbers[row][0],"$" + FormatNumber("###,###,###.00",numbers[row][1])); //Populate your rows with their respective titles, add back the dollar sign, and re-format That should work for you and get you back on track. Sorry about that!
×
×
  • Create New...