Jump to content

step

Registered Users - Approved
  • Posts

    962
  • Joined

Converted

  • Location
    Charlotte, NC

Converted

  • Occupation
    Developer

Converted

  • FusionPro Products
    Yes

Converted

  • FusionPro VDP software version
    9.3.15

Converted

  • OS
    Mac OS 10.10.5

Converted

  • Acrobat Version
    Acrobat X (10)

step's Achievements

Mentor

Mentor (12/14)

  • First Post Rare
  • Collaborator Rare
  • Posting Machine Rare
  • Conversation Starter Rare
  • Week One Done

Recent Badges

10

Reputation

  1. Whoops I forgot to get the record from the external data field. Try this: var externalDF = new ExternalDataFileEx("Competitor-ExDF.xlsx", "Excel"); var unique = function (value, index, self) { return value ? self.indexOf(value) === index : false; }; var getResource = function (value) { [color="Red"]var competitor = externalDF.FindRecord("CompetitorDropDown", value); if (competitor) { var competitorImage = externalDF.GetFieldValue(competitor, "CompetitorImage"); if (competitorImage) { return Resource(competitorImage).content; } } return '';[/color] }; return ["CP-Product-1-A", "CP-Product-1-B", "CP-Product-1-C"] .map(Field) .filter(unique) .map(getResource) .filter(String) .join(' ');
  2. Would this work? var externalDF = new ExternalDataFileEx("Competitor-ExDF.xlsx", "Excel"); var unique = function (value, index, self) { return value ? self.indexOf(value) === index : false; }; var getResource = function (value) { var fieldValue = externalDF.GetFieldValue(value, "CompetitorImage"); return fieldValue ? Resource(fieldValue).content : ''; }; return ["CP-Product-1-A", "CP-Product-1-B", "CP-Product-1-C"] .map(Field) .filter(unique) .map(getResource) .filter(String) .join(' ');
  3. Is the maximum number of concurrent usages of FusionPro 10 Server something that is tied to your license or is it a configuration that can be adjusted? I vaguely recall it being a configuration in earlier versions of FP but I can't find it anywhere in FP10. I have two different Windows 2012 servers set up with FusionPro VDP Producer (API) 10.0.3: Server 1: 8GB RAM; 2.30GHz CPU; 4 (virtual) processors - allows only 1 composition Server 2: 16GB RAM; 2.30GHz CPU; 8 (virtual) processors - allows 3 concurrent compositions I'm not sure the specs of our FusionPro 9 servers but we used to be able to get 16 concurrent compositions per server. Needless to say, this is shift is somewhat crippling. Any ideas on what I'm missing?
  4. You're comparing strings rather than dates. You should convert them to actual dates: var birthday = new Date(Field('BIRTH_DATE')); var cutoff = new Date('08/31/1963'); var file = birthday > cutoff ? 'Entertainment' : 'Better with Age Day_new'; return Resource(file + ' TL_Sept.jpg');
  5. You could try this in your OnRecordStart callback: // All pages to compose during composition. var pagesToImpose = [3, 4, 5, 6]; var page = 0; while (++page) { try { var compose = pagesToImpose.indexOf(page) > -1 || IsPreview(); FusionPro.Composition.SetBodyPageUsage(page, compose); } catch (e) { break; } }
  6. I bet you're variable is actually returning a non-breaking space character ( ) rather than an actual space. Try this: return RawTextFromTagged(Field("Partner Code")).replace(/\s/g, '');
  7. Because cases have been set for all other scenarios. If none of the cases evaluated to true, then it stands to reason that the only remaining option would be the 72x36 size. Check out this reference on switch statements to get a better understanding. That's leads me to believe that you haven't accurately described the values your "Years of Service" field contain. I can't really help you any further without seeing an example of your data/template.
  8. You could use the substr method to parse the values from your string: // Your field here. var field = Field('SLOT1'); var type = field.substr(0, 1); switch (type) { case 'V': var code = field.substr(1, 3); break; case 'C': var code = field.substr(1, 2); var serviceCode = field.substr(3, 2); var mileage = field.substr(5, 6); var value = field.substr(11, 4); break; } Alternatively, you could use regular expressions to match the pattern: // Your field here. var field = Field('SLOT1'); var [type, code, serviceCode, mileage, value] = (field.match(/^(.)(.{2,3})(.{2})?(.{6})?(.{4})?$/) || [,'B']).slice(1);
  9. Yes, I know. But you only have 3 size options. The switch statement determines which size to use. From there, the style is appended to the size to create the page name. Are you saying that the value of the "Years of Service" field is a string value representing a range of numbers (like "1-5") or just that the user will never enter a number outside of those specified ranges (like 6)? The latter of which shouldn't make a difference and the code should still work. But, if the values are string ranges, you could modify the code like this: var background = Field("Background") || 'Style 1'; switch (Field("Years of Service")) { case '1-5': case '10-15': size = '18x12'; break; case '20-25': size = '60x30'; break; default: size = '72x36'; } FusionPro.Composition.SetBodyPageUsage(background + " " + size, true); Right, and again, that's what the code I posted is doing. It determines the size needed based on the "Years of Service" and adds the style selected from the drop down list to it.
  10. Both of those variables are set to the same value. Is that intentional? I don't think that will work. If I'm understanding correctly, Gdellaiera is trying to determine which page to use here based on the "Years of Service" field and appending the style to the end of the string. So the correct syntax would be: /** * When the vale of the "Years of Service" field is between 10-15, the * page size should be 18x12 regardless of the style selected in the * "Background" field. So set the `page` variable to the appropriate size * and append the style to the end to dynamically cover all three styles. */ if (Field("Years of Service") >=10 && Field("Years of Service")<= 15) { var page = "18x12 " + Field("Background"); } I think a better way to accomplish this task would be: // Get the "Years of Service" value and cast it as an integer for comparisons. // Default the value to `1` when the field is empty. var yearsOfService = Int(Field("Years of Service")) || 1; // Get the style value from the "Background" field. // Default to `Style 1`. var background = Field("Background") || 'Style 1'; // Use a switch statement to determine which page size we should be using. We'll // set the `size` variable to the first expression that evaluates to `true`. switch (true) { // Check to see if the `yearsOfService` is 15 or less. If it is, we can set the // size to 18x12 and none of the other expressions in this `switch` will be evaluated. case yearsOfService <= 15: size = '18x12'; break; // If the `yearsOfService` is more than 15, we will check to see if the // `yearsOfService` field is 25 or less. If it is, set the size to 60x30. case yearsOfService <= 25: size = '60x30'; break; // If neither of the two previous cases were true, that means the `yearsOfService` // is greater than 25, so we can set the size to 72x36. default: size = '72x36'; } // Since you've already set all of the body pages to `false`, you only need to // enable the correct page. FusionPro.Composition.SetBodyPageUsage(background + " " + size, true);
  11. Use span tags? team.members.push({ team: [color="Red"]'<span font="Arial" color="white">'[/color] + ToUpper(teamname) + [color="red"]'</span>'[/color], name: Field('Name' + i), headshot: CreateResource(Field('Headshot' + i), 'graphic', true), titleone: Field('TitleOne' + i), titletwo: Field('TitleTwo' + i) });
  12. The team names in the 'teams' object need to match (case-sensitive) the team names in your data. So, in this case, you could modify the object definition to be: var teams = { [color="Red"]'Onsite Team'[/color]: { color: [72, 15, 0, 0] }, [color="Red"]'Service Leadership'[/color]: { color: [94, 68, 1, 0] }, [color="Red"]'Support Team'[/color]: { color: [64, 6, 100, 0] }, [color="Red"]'Regional Team'[/color]: { color: [86, 30, 55, 9] } } There are two other changes to note: team.members.push({ team: ToUpper(teamname), name: Field('Name' + i), headshot: CreateResource(Field('Headshot' + i)[color="red"], 'graphic', true[/color]), titleone: Field('TitleOne' + i), titletwo: Field('TitleTwo' + i) }); person.headshot.content.replace('/>', 'width="' + [color="red"]([/color]colWidth - picCell.Margins.Left - picCell.Margins.Right[color="red"])[/color] + '"/>') : '';
  13. var XDF = new ExternalDataFileEx("PostcardContent.txt", "\t"); var s = XDF.GetFieldValue(XDF.FindRecord(0, Field('Header')), 1) || Field('HeaderCustom'); s = ReplaceSubstring(s, "[COMMUNITY NAME]", Field("Community Name")); s = ReplaceSubstring(s, "[RSVP]", Field("RSVPPhone")); return s;
  14. Because your site is sending back the "option" the user selected rather than the value of the option the user selected, I think you'll have to continue referencing the external data file. That being said, you can certainly simplify things. You consolidate your two "header" rules into one: var XDF = new ExternalDataFileEx("PostcardContent.txt", "\t"); return XDF.GetFieldValue(XDF.FindRecord(0, Field('Header')), 1) || Field('HeaderCustom'); The above code will search for a value in the first column of your data file that matches the value of the "Header" field. If found, the corresponding value of the second column will be returned. If nothing is found, it will return the value of the "HeaderCustom" field. I set that up in accordance to the rule you supplied but I would think the value of the custom field would take precedence over the pre-written options. If that's the case, you can just reverse the order: var XDF = new ExternalDataFileEx("PostcardContent.txt", "\t"); return Field('HeaderCustom') || XDF.GetFieldValue(XDF.FindRecord(0, Field('Header')), 1);
×
×
  • Create New...