AngelBenitez Posted August 21, 2023 Share Posted August 21, 2023 Hello, I am working on creating an XDF rule in MarcomCentral to achieve the following: I would like to populate fields in a flyer from an Excel file (.xlsx) based on a user's selection from a dropdown menu. For instance: Users can choose between two managers, John or David. If a user selects 'John,' all of John's information should populate the flyer. If a user selects 'David,' all of David's information should populate the flyer. var XDF = new ExternalDataFileEx("ManagerInformation.xlsx","Excel"); var Manager = ""; var PhoneNumber = ""; var MobileNumber = ""; var EmailAddress = ""; var finaladdress = ""; var i = DeptXDF.FindRecord("Manager", Field("Text_Manager")); if (i>0 && Field("Text_Manager") != "") { Manager = DeptXDF.GetFieldValue(i, "Manager"); PhoneNumber = DeptXDF.GetFieldValue(i, "PhoneNumber"); EmailAddress = DeptXDF.GetFieldValue(i, "EmailAddress"); finaladdress = AppendText(finaladdress, "", Manager); finaladdress = AppendText(finaladdress, "<br>", PhoneNumber); finaladdress = AppendText(finaladdress, "<br>", EmailAddress); } return finaladdress; The reason that I want to use an XDF is because this information is constantly changing If anyone knows if this rule is correct, and the additonal steps I would need to do in order to link the XDF file within MarcomCentral, I would greatly appreciate it. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted August 21, 2023 Share Posted August 21, 2023 Well, I can't test it out without the rest of the job, including the primary data file and the XDF, but that looks right. Though you can also accomplish this without any JavaScript at all by setting up the XDF as a Secondary Data Source (from the menu, FusionPro -> Data Definition -> Secondary Data Sources, click Add to define the Excel file as a data source), then check the "Filter/map records where" box, set up the mapping between the XDF field "Manager" and the primary field "Text_Manager", and check the "Add to field list with prefix" box. Then the matched fields from the XDF will appear in the Text Editor variables list, and you can use them directly. Quote Link to comment Share on other sites More sharing options...
AngelBenitez Posted August 21, 2023 Author Share Posted August 21, 2023 Hello @Dan Korn, Thank you for your assistance. I have a question regarding the XDF file. If I intend to use this file across multiple products, is it possible for me to update it once and have the changes propagate to all products? This file contains constantly changing information, so I'm wondering if I need to update it individually for each product or if there's a way to update it universally for all products. Quote Link to comment Share on other sites More sharing options...
AngelBenitez Posted August 21, 2023 Author Share Posted August 21, 2023 Hello @Dan Korn, I was able to figure it out. Thank you so much for your help on this, I really appreciate it. 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.