Jump to content

Writing data back to the data source


jurgmay

Recommended Posts

Hi all,

 

Does anybody know if it's possible to write data back to the data source during composition?

 

I'd like to be able to calculate a unique number that would get written back to an empty field in the data source.

 

A pseudo-code example might be...

 

externalDataFile.SetFieldValue(row, column, value)

 

I see there's a GetFieldValue method for the ExternalDataFileEx object but no 'Set' equivalent so I'm guessing that this can't be done...

 

Anyone got any thoughts?

 

Thanks,

 

Juerg

Link to comment
Share on other sites

The short answer is No: input is input, and output is output, and never the twain shall meet. Even if there were a mechanism to write data back to a file, there's no guarantee that you have write access to it. And what happens if you modify the file while you're in the middle of trying to read from it?

 

Can you explain more broadly what you're trying to accomplish? I might be able to offer a more specific suggestion with a better overall picture.

Link to comment
Share on other sites

Hi Dan,

 

Thanks for the reply.

 

Here's my scenario...

 

I have a Management Information System (MIS) that I export all my customer, invoice and job data from. The primary data file from FPs point of view is 'Invoices.csv'. I then loop through each record pulling all related records from 'Jobs.csv' using the invoice number as the Primary Key.

 

Using JavaScript I then have some business logic that parses the job data and determines which product types were ordered. From this I can then determine two promotional messages to pull into the page to cross sell other products and services to that customer.

 

So, for example, the customer may order some posters. My business logic might then promote clip frames and offer a discount off that item.

 

If you're still with me(!), what I'd like to be able to do is write a 'flag' back to the 'customer' data file that simply enters a '1' the appropriate column indicating that a particular offer has been made to that client. The next time we issue an invoice the business logic will say, hey, we've already offered these guys a discount so we're not going to offer another one (at least not for a while).

 

Without the ability to monitor which offer has been sent to which client we are in danger of sending a discount with every invoice!!!

 

If I was able to write data back to the 'customer' file I would then feed that data back into the CRM so that the next time I do an invoice run the offers that were previously used would have a flag set in the appropriate column and the business logic would then pull in a different message and not another discount. After certain criteria have been met the discount flag will be reset to 0 so that the customer then becomes eligible for a discount again. And so the cycle goes continues...

 

Hopefully that makes sense! :)

 

Essentially what I need is a mechanism that can record the results of the business logic that I'm using within FusionPro. Being able to write back to the source data is my preferred method but I'm open to suggestions!

 

Cheers!

 

Juerg

Link to comment
Share on other sites

Hi - just realised my original post mentioned writing a 'unique' value back to the data file. This is no longer necessary as we can use a simple 'flag' mechanism.

 

Sorry for any confusion!

 

Juerg

Link to comment
Share on other sites

Essentially what I need is a mechanism that can record the results of the business logic that I'm using within FusionPro. Being able to write back to the source data is my preferred method but I'm open to suggestions

Well, FusionPro isn't really designed to handle any generic business logic that you may require. Essentially, it's just a variable data composition engine with a GUI front end for template building. It does have the powerful JavaScript rules subsystem with which you can do a lot of sophisticated cleansing and merging of data, but it's not really designed to function as a database or as an asset or workflow management system.

 

What comes to mind for me is a custom application which uses FusionPro Server to do the composition, but has other mechanisms to handle the business logic of keeping track of customer records and such. The app (your MIS or something that talks to it) would simply invoke FP Server through DL Queue or some other means to compose the output.

 

It may even be more appropriate for your MIS or another app to do some of the other business logic you mention, such as pulling the data from the Jobs spreadsheet based on the key in the Invoices spreadsheet. You're basically using Excel and FusionPro Desktop to emulate a relational database system, which is something that neither product was designed to do. And you have a workflow with at least a few manual steps, including clicking a button in FP Desktop. So far, you're making it work, sure, but if this is a serious enterprise application which you want to make truly automated, secure, maintainable, scalable, and auditable, I would consider investing in more appropriate tools for those tasks, including FusionPro Server. Let FusionPro do what it's best at, which is composing the output, and use a real database and a custom application to do the rest.

 

That said, even in FP Desktop, you can use the FusionPro.Composition.CreateXMLLogFile and FusionPro.Composition.LogXMLMetadata functions to write any kind of information you want to a file at composition time, and you could add a step to parse that file to your workflow. But I'd still recommend an FP Server-based solution.

Link to comment
Share on other sites

Hi Dan,

 

All I've done is take this example http://forums.printable.com/showthread.php?t=392 and expand it a bit so I didn't think I was doing anything beyond the scope of FP... Given the JS implementation and some of the threads on this forum the use of business logic seemed like quite a good idea!

 

I agree that what I'm doing is a bit of a kludgy system but the fact is that our MIS is a closed system and won't talk to anything but itself. Our only way to get data out of it is as a .csv file so that's what I'm stuck with :( I'm told that this MAY change in the next 12 months but experience tells me that it could be two years or more before that will happen.

 

FP Server is way beyond us at the moment so as much as that might be a better solution I simply can't justify it... We're thinking about FP Direct to solve some speed issues we're having on some larger projects so perhaps we'll go one step at a time!

 

I think I'll take a look at the FusionPro.Composition.CreateXMLLogFile and FusionPro.Composition.LogXMLMetadata functions and go from there.

 

Thanks for your help.

 

Juerg

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...