Retrieving multiple attachments from DBXL to InfoPath forms - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Retrieving multiple attachments from DBXL to InfoPath forms

Last post 01-09-2011 06:00 PM by ZhenYuan. 30 replies.
Page 2 of 3 (31 items) < Previous 1 2 3 Next >
Sort Posts: Previous Next
  • 12-21-2010 08:32 PM In reply to

    Re: Retrieving multiple attachments from DBXL to InfoPath forms

    Hi Patrick,

    Thanks, you mean a trial of qRules?

    Actually, I was thinking of another solution. Is it possible to decode the file name, file size and URL to the attached attachments based on its base64 coding? If it can be done (in SQL maybe?), we can resolve the base64 string into something meaningful for the users because the objective of my retrieval is to display the difference in field values between different versions of our form. This can be done easily for normal string fields but we are facing some problems with attached attachments.

    Therefore we figured we are ok if we can just display the filename, file size and a URL for users to download the attachments. Can this be done via InfoPath?

     

    Thanks,

    Zhen Yuan

  • 12-22-2010 12:08 AM In reply to

    Re: Retrieving multiple attachments from DBXL to InfoPath forms

    ZhenYuan:

    Hi Mel,

     We do not have qRules. Will your copytable command still work?

    If we are ok with retreving some specific data like filename, file size and a url link to download the attachment, is there another solution preferably without qRules?

     

    Thanks!

    Yes - the template has already been injected with a trial version of qRules. Please go ahead and modify for your environment to see how CopyTable works.

      

    ZhenYuan:

    Therefore we figured we are ok if we can just display the filename, file size and a URL for users to download the attachments. Can this be done via InfoPath?

     

    Here again, we would suggest qRules because it has a GetAttachmentAttribute command which can return the file attachment name, extension, file size and the encoded string itself. Of course, it can also be done in code. I did a quick search and here's what I found: http://www.infopathdev.com/forums/p/15120/53602.aspx - looks like the code works in InfoPath 2007 as well.

     

    Mel Clemente
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™

  • 12-22-2010 12:47 AM In reply to

    Re: Retrieving multiple attachments from DBXL to InfoPath forms

    Hi Zhen Yuan,

    Mel spent about 4 hours working on that sample for you so it would be cool if you can use that. It includes qRules trial and if that solution works for you, we'll give you one free license of qRules for your development (on account of the fact that you are a DBXL customer). qRules will help you in lots of ways and you can integrate it with your existing code. We provide it to save you time. It also saves us time, since everyone is always asking us the same coding questions - we got tired and just created qRules library which has the most commonly requested functions in it, including the repeating table copy that Mel implemented for you as well as the get attachments name. 

    If you need more consulting help, please don't forget that Qdabra does offer paid consulting services. :)  Great rates, timely service, and the best techniques around to help you create super solutions using InfoPath, SharePoint and SQL.

    Cheers!

    Patrick Halstead
    Project Manager at Qdabra
  • 12-22-2010 02:48 AM In reply to

    Re: Retrieving multiple attachments from DBXL to InfoPath forms

    Hi Patrick, Mel,

    Thanks! I will try out qRules very soon. However, I'm kinda in a tight situation to produce the main part of my form so I won't be able to really test qRules till next week. And I am currently having a supremely frustrating problem where I tried to use code for URL with input parameters (http://www.infopathdev.com/blogs/hilary/archive/2008/10/07/url-input-parameters-gotcha.aspx). My form broke and despite rolling back a previous version, DBXL is still using the broken code! The form looks like the old working form but the code hasn't been rolled back... So I'm left with the form with broken code... I save my form designs as different files and I think somewhere, its caching my form code.

    Omg, feel like throwing my laptop through the window...

  • 12-22-2010 03:21 AM In reply to

    Re: Retrieving multiple attachments from DBXL to InfoPath forms

    Oh my gawd...

    Solution: Need to publish the form locally after the changes are made... Answer was staring right back at me in DBXL Admin Tool page.

    This is a side track but I would like to tag this particular post to code caching so that fellow "victims" like me can avoid shredding their laptops when they encounter this.

    The solution would be to publish your form to a local location in your computer and upload that copy to DBXL. Somehow, by publishing, it will tell DBXL to take this new code. Otherwise, by if you were to only save your form as a different file name and upload to DBXL, DBXL may still recognize no change to the code and continue using the as in my case, broken code.

    Extremely frustrating, spent 2hrs on this issue...

    Filed under:
  • 12-22-2010 05:15 AM In reply to

    Re: Retrieving multiple attachments from DBXL to InfoPath forms

    Oh no! Don't spend 2 hours banging your laptop against the wall. Send email to Support. We're here to help you with all of your blocking DBXL issues/questions. :)

    BTW, you don't need to publish it locally, but you do need to Save the latest version to DBXL Admin Tool. Are you saying that you did that and it didn't work? What version of DBXL are you on (lower left corner of DBXL Admin Tool)

    Patrick Halstead
    Project Manager at Qdabra
  • 12-22-2010 05:15 PM In reply to

    Re: Retrieving multiple attachments from DBXL to InfoPath forms

    Hi Patrick,

    You guys will be flooded if I were to send all my queries here without trying to solve some myself. Anyway which email should we send to in future? We are using DBXL 2.4.3828.24950.

    I did save the latest version to DBXL Admin. However, only the form's layout was updated. The underlying code was still using the old broken code. For example, I rolled back to an older form version which did not have an additional dropdown list box. The newly "updated" form in DBXL now opens with the old layout without the dropdown list box but still throws an exception error from my broken on loading event code. This happens despite my older form not having any on loading event code at all!

    So it made me deduce that although DBXL detects my rolled back form as an updated version, somehow it did not recognize the difference in form code and did not update the server copy (Because if I preview my form locally, I don't get the exception catch error message).

    I'll try to replicate the error again because I still need to find out how to open forms with input parameters. Wish me luck...

  • 12-22-2010 08:19 PM In reply to

    Re: Retrieving multiple attachments from DBXL to InfoPath forms

    I think this issue you encountered is an InfoPath issue, not a DBXL issue.  DBXL doesn't treat a form's code as a separate entity from the rest of the form and passes the whole XSN along as-is.  I think you have to actually build the code in VS or VSTA to get the form's DLL to update.  Just saving the form will take whatever DLL was built last and not build a new one, but publishing will cause a new build to happen, so that's something to keep in mind.

    FYI - qRules has features for accessing input parameters too :-)

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 01-04-2011 03:37 AM In reply to

    Re: Retrieving multiple attachments from DBXL to InfoPath forms

    Hi Mel,

     I've tried your form but on form load (or preview), I have this error message:

    The query cannot be run for the following DataObject: QueryAttachments
    InfoPath cannot run the specified query.
    The SOAP response indicates that an error occurred on the server:

    System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> Qdabra.Dbxl.Domain.DbxlException: Error D0002:
    ----------------------
    The database 'SampleDB' is not registered for use
    All databases used by QueryDB must be specified in web.config
    ----------------------

       at Qdabra.DataBaseService.QueryDBService.CheckForDatabaseInConfig(String databaseName)
       at Qdabra.DataBaseService.QueryDBService.GetConnectionString(String database, Boolean& isDbxlDb)
       at Qdabra.DataBaseService.QueryDBService.ProcessInputs(String database, String& table, String[]& columns)
       at Qdabra.DataBaseService.QueryDBService.GetRequestedData(String database, String table, String[] columns, Boolean distinct, String whereClaus, String orderByClaus, Int32 maxRows, Boolean countOnly)
       at Qdabra.DataBaseService.QueryDBService.InternalGetDataSet(XmlNode queryXml, String& table, Boolean& countOnly)
       at Qdabra.DataBaseService.QueryDBService.GetColumnsXMLQuery(XmlNode queryXml)
       at Qdabra.DataBaseService.QueryDBService.GetColumnsXMLStrQuery(String queryXml)
       --- End of inner exception stack trace ---

    In any case, the form then loads and seem to return the data in my table to the form. Looks good! But can you teach me how to return the filename and URL to the file where users can click and save the attachments to their machines? This is because we are trying to minimize the email size when we route the "forms" in our company and thus are exploring text only forms. Therefore the need for URLs to files.

     Thanks again and happy new year everyone!

  • 01-05-2011 01:16 AM In reply to

    Re: Retrieving multiple attachments from DBXL to InfoPath forms

     Hi Mel, Patrick, 

    In addition, we are not using sharepoint. We are using DBXL to store attachments as varchar(max). Can we still use the "GetAttachmentAttribute" command in qRules to get our attachment's URL? If yes, are there documentations to teach me how to create the commands?

    We would like to find out more on qRules capabilities.

    Thanks!

    Zhen Yuan

  • 01-05-2011 06:46 AM In reply to

    Re: Retrieving multiple attachments from DBXL to InfoPath forms

    The GetAttachmentAttribute is not related to SharePoint. It's related to the meta-properties belonging to the attachment as stored in the InfoPath form. You can use it to get your attachment's name, size, etc. Here's one blog on it: http://www.infopathdev.com/blogs/aruna_akella/archive/2010/06/30/how-to-use-the-getattachmentattribute-command.aspx. It doesn't provide the URL property though since that is a ShP property. I guess I'm confused. Do you want to use it to get the link for where the attachment was stored? The link should be in another field that you chose when you uploaded the attachment. What am I misunderstanding here...?

     

    Patrick Halstead
    Project Manager at Qdabra
  • 01-06-2011 02:37 AM In reply to

    Re: Retrieving multiple attachments from DBXL to InfoPath forms

    Hi Patrick,

    I am trying to get the URL link to the attachment stored in my SQL server. How do I get this link into my form? I thought it could be done with GetAttachmentAttribute? No?

  • 01-06-2011 08:04 AM In reply to

    Re: Retrieving multiple attachments from DBXL to InfoPath forms

    Hi:

    Sorry to add yet another voice to this thread. I've read through it, and I keep coming back to your first post. Please correct me if I am mistaken on anything:

    1. You are saving XML data from forms to SQL using DBXL
    2. One of the fields from your XML that you are saving is base 64 from a file attachment control
    3. You want to be able to pull this data back from SQL into other forms
    4. You are using QueryDB for this

    Is this correct?

    In the past, in InfoPath, I've returned base 64 data (stored in SQL as varchar(max)) to forms for viewing using QueryDB. When you create the QueryDB data connection, all data fields are interpreted as string data types when InfoPath creates the data schema. I save my form as source files and modify the secondary data connection in question to use a base 64 data type for the field in question. Then I am able to add an appropriate control to my form that is bound to my secondary data source. Is this an acceptable solution? Have I correctly understood what you are trying to do?

    Hilary Stoupa

  • 01-06-2011 11:00 PM In reply to

    Re: Retrieving multiple attachments from DBXL to InfoPath forms

    Hi Hilary,

    You got it all correct except 3. I'm actually trying to pull data back to another view on the same form. The data will be from previous revisions of the form and the view is used as a audit trail view.

    Your idea sounds good... Very good! Does it work if I place my attachments in a repeating section and try to pull back base64 attachments from SQL for all attachments in a specific revision no?

    Anyway, I tried to to save my form as source and modify secondary data but did not succeed in finding where to change my string to base64? Am I supposed to modify the SDS's .xml file? Or .xsd file? Which line am I supposed to replace string to base64?

     

    Thanks for your hint!

    Zhen Yuan

  • 01-07-2011 10:09 AM In reply to

    Re: Retrieving multiple attachments from DBXL to InfoPath forms

    I was wrong, I'm afraid -- this works great for pictures (open the .xsd for the secondary data connection, change data type from xsd:string to xsd:base64Binary, then you can add a picture control bound to your secondary data source) but does not work for files. IP won't allow you to insert a file attachment control. With manual modifications to the view, I was able to get my file to display, but could not open it. I attempted some additional manual modifications to the manifest, but no love.

    I think you may need to either submit these file attachments to DBXL on their own (using qRules, see SaveToDbxl command) and then display them as a link that the user can click to open, or you will need to use code. If you choose to use code, you can still use your 2ds to return the string base 64 data from your DB. You'd need a base 64 field in your main data source, sounds like it would need to be repeating. You could then add as many instances of that field as you have rows returned from you 2ds from your queryDB query. Set the value of each to the returned base 64 string from your DB.

    Oh, actually, you could use qRules for the approach I've suggested code for as well -- the insert command to insert the right number of file attachments, and the setvalue command to populate them....

    I did a quick test using a rule -- added a file attachment control bound to a main data source, set its value to base 64 returned from a queryDB query, and the file could be opened from the file control.

    Hilary Stoupa

Page 2 of 3 (31 items) < Previous 1 2 3 Next >
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.