Go Back   PTI Marketing Technologies User Community > Support > Issues, Questions, Etc.

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old March 11th, 2018, 11:37 PM
WMajor WMajor is offline
Forum n00b
 
Join Date: Aug 2014
Location: Brisbane, Australia
Posts: 8
Default Writing to a database table

Hi, once connected to a database table and retrieving data, is there a way to write to each record in the table to set a flag to say that the record is printed?

We have a database app which updates a table. We don't want the same records printed each time. In the event that we need a record reprinted, we could unset the "printed" flag for that record.

Is this possible?
__________________
___________
Warren Major

FusionPro 9.1.0/CS6 | Acrobat X Pro 10.1.11 | Win 7 64-bit | Intel i7 16G Ram
Reply With Quote
  #2  
Old March 12th, 2018, 03:06 PM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,229
Default Re: Writing to a database table

Accessing a database from FusionPro is a read-only operation. There's no way to write back to a database. Though in FusionPro VDP 10, you can write back to an ExternalDataFileEx object if it's in a flat-file (tab- or comma-delimited) format.

Also, technically, composing a record in FusionPro is not the same as "printing" it. Some print shops put a barcode on each output page, then scan the printed output to track which pages printed successfully or not so they can reprint pages. But it sounds like you're trying to remember which records were already composed. To me, that suggests a FusionPro VDP Server workflow, where your own application code both keeps track of what's been composed, and automatically invokes FusionPro VDP as needed.
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
  #3  
Old August 23rd, 2018, 09:17 AM
Paul Paul is offline
Forum n00b
 
Join Date: Oct 2009
Location: Birmingham AL
Posts: 6
Default Re: Writing to a database table

Dan,


Can you elaborate when you say, "Though in FusionPro VDP 10, you can write back to an ExternalDataFileEx object if it's in a flat-file (tab- or comma-delimited) format." Do you have a sample template that does this? Or, what would a rule look like if I added it to the FrodoTravel example in the FusionPro tutorial folder, say (even though the outcome is obvious with the Frodo template) I want to capture the sheets used in the job using a rule, return FormatNumber("000000",((FusionPro.Composition.page NumberInJob/2)))?
Reply With Quote
  #4  
Old August 23rd, 2018, 02:53 PM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,229
Default Re: Writing to a database table

Quote:
Originally Posted by Paul View Post
Can you elaborate when you say, "Though in FusionPro VDP 10, you can write back to an ExternalDataFileEx object if it's in a flat-file (tab- or comma-delimited) format."
You can call the SetFieldValue and Save functions on your ExternalDataFileEx (XDF) object. The XDF file has to be in the Search Path, and has to be tab-delimited.
Quote:
Originally Posted by Paul View Post
Do you have a sample template that does this?
No, not handy, though there is a partial example here:
http://forums.pti.com/showthread.php?p=21065
Quote:
Originally Posted by Paul View Post
Or, what would a rule look like if I added it to the FrodoTravel example in the FusionPro tutorial folder, say (even though the outcome is obvious with the Frodo template)
Well, I'm not sure the outcome is obvious. At least it isn't to me. It depends what you're trying to do.

But you could do something like this in the Frodo job: Add a new field (a new value at the end of the first row, after a tab) to the XDF named "count", add "ExtraFiles" to the Search Path, and add this code to the OnRecordStart rule, after the "for" loop:
Code:
data.SetFieldValue(x, "Count", Int(data.GetFieldValue(x, "Count")) + 1);
data.Save();
You probably also want to put that in an if (!FusionPro.inValidation) conditional.

That will update the "count" field in the XDF for each time a record with that destination is composed (or previewed).
Quote:
Originally Posted by Paul View Post
I want to capture the sheets used in the job using a rule, return FormatNumber("000000",((FusionPro.Composition.page NumberInJob/2)))?
Well, again, you need to call the SetFieldValue and Save functions on an ExternalDataFileEx object, and write the data back to a particular record (row) and field (column) in the XDF. And I'm not sure putting FusionPro.Composition.pageNumberInJob in there would work, though again, it's not clear to me what you're ultimately trying to accomplish.
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
  #5  
Old August 24th, 2018, 09:33 AM
Paul Paul is offline
Forum n00b
 
Join Date: Oct 2009
Location: Birmingham AL
Posts: 6
Default Re: Writing to a database table

Thanks Dan,


I will play around with the information you gave me. Our company has recently purchased a more intelligent inserter allowing us to have a job where each record will have different page counts. I have FusionPro creating a datamatrix barcode that captures information to talk to the inserter. I would like to log that information and have a total sheet count; per output file and per total job.
__________________
Paul

FusionPro 10.0.26 | Acrobat DC | Win 7 64-bit
Reply With Quote
  #6  
Old August 24th, 2018, 10:05 AM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,229
Default Re: Writing to a database table

Quote:
Originally Posted by Paul View Post
I will play around with the information you gave me. Our company has recently purchased a more intelligent inserter allowing us to have a job where each record will have different page counts. I have FusionPro creating a datamatrix barcode that captures information to talk to the inserter. I would like to log that information and have a total sheet count; per output file and per total job.
That sounds like a job for the XML log file, which is a lot simpler. In OnJobStart, call FusionPro.Composition.CreateXMLLogFile(), optionally with a file name (and path), and the file will have the information you need at the end. You can use any XML parser on it.

Though as I noted earlier in this thread, many of your requirements suggest a FusionPro Server-based workflow. You can also add the "XMLLogFile=<path>" setting to the CFG file for any job, without the need to modify a rule.
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
  #7  
Old August 24th, 2018, 02:08 PM
Paul Paul is offline
Forum n00b
 
Join Date: Oct 2009
Location: Birmingham AL
Posts: 6
Default Re: Writing to a database table

Perfect!

I'm shocked - something was easy.
Thanks Dan
__________________
Paul

FusionPro 10.0.26 | Acrobat DC | Win 7 64-bit
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 10:10 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.