Workflow Soluiton

 View Only
  • 1.  Read Excel to Grid/Upload to DB

    Posted Jan 13, 2012 08:32 AM

    Hello,

    Just getting started with Workflow and running in to some issues getting data out of Excel.

    I can use text boxes to prompt for information and pass them to a SPROC then return the results to a grid just fine (web form pass to SPROC Int Lib then pass to web form grid); but now I'm trying the following and can't seem to figure it out...

    I have a web form with an InputFileComponent, this way an end user can browse and select an Excel spreadsheet from their local machine. I want to be able to read the entire file (which will have the same headers and formatting, just different amounts of data each time); validate the data; then display it on a grid in a web form for edits to be made. Once submitted, it will write the data to a SQL DB and start another Workflow for each line of data where it e-mails the end user with a link and instructions.

    I think I have create the later part just fine, but for the life of me I can't seem to pass the filename from the InputFileComponent to the "Read File", the "Read Excel Spreadsheet" or even an Excel Int Lib... Even during testing I hard coded the file name via "Read Excel Spreadsheet" which works, but the output (which looks to be an array) isn't showing up as a usable variable when I try to display the information in a grid.

    I've tried looking around the forums, Workflow SWAT, etc., but I'm not seeing anything that fully explains how to use these functions. Any help would be much appreciated!



  • 2.  RE: Read Excel to Grid/Upload to DB

    Posted Jan 13, 2012 04:26 PM

    It looks like you just need to pass it into the right data type form. "InputFileComponent" outputs a FileDataType data type, Read Excel Spreadsheet outputs DataRow data type, etc. Your best bet would probably be to use your Integration Library. If you're using the InputFile method then just map that into what your Excel Integration library will read using Multiple Value Mapping, since it is an array. Once it's in a readable format then you will need to select that datatype when selecting your grid. Your variable should then show up when you select Item Source and columns will appear from your integration library. If I wasn't clear just let me know and I'll try to take a screenshot or two.

     

    Also just to note, if you're unsure of a datatype just right click on a downstream component and select browse data. Click that variable, then check show datatype. This should make things a lot easier. I'm new at this myself but have come to find out the possibilities are endless. Good luck!



  • 3.  RE: Read Excel to Grid/Upload to DB

    Posted Jan 20, 2012 08:22 AM

    Thanks for the quick reply. It sounds easy, and I thought it would be something like this... but still nothing.

    I see that 'InputFileComponent' outputs as 'FileDataType'; what I don't see is how I use that variable in 'Read Excel Spreadsheet' or even in an Integration Library... Maybe I'm not using the correct Int Lib (which type of library would you recommend?), but in both it seems I only get a browse button to select a static file. I don't see anything anywhere that allows you to map a variable to the FileDataType Name.

    If it helps, I'm using Workflow Manager v7.1.1400.28.

    Thanks again,



  • 4.  RE: Read Excel to Grid/Upload to DB

    Posted Jan 21, 2012 04:20 PM
      |   view attached

    I take it you used the Excel Generator in your Integration Library? I just went through this myself and got it working. Assuming you used the Excel Generator and imported a template of the Excel file you spoke of, then the rest should happen in your form. 

     

    Once opened, you need to import the Integration Library you just created. If you did everything as default, then you should have Dynamic Read/Write Components. The Read component is what you're looking for -- drag into your workflow after your initial form builder. The setup tab should have the "File Data Type Variable Name" option list and you can browse and select your variable from your InputFile Component. 

     

    As for displaying it on your grid, you just need to select the DataType which would be under the category of the name of your Integration Library. Your results should then show up as a selectable variable. I'll attach an example that should show everything for you. Hopefully it clears it up for you.

    Attachment(s)

    zip
    WebFormsProject2.zip   1.26 MB 1 version


  • 5.  RE: Read Excel to Grid/Upload to DB

    Posted Jan 24, 2012 09:10 AM

    Was unable to use your attachment. Says I'm on 1400 and it was written on 1460...

    Yes, that's how I created the Excel Generator Integration Library. A few times actually... but I thought I could use the Process variable in the GridViewComponent of the WebForm down stream from the Int Lib Dynamic Read. I did the Multiple Mapping instead, like you suggested, and now I can see the data in my error message but it still won't display in the GridViewComponent.

    I put in an Exception trigger with a Display Content down stream and this is what I get:


    LogicBase.Components.FormBuilder.FormBuilderComponent
    Form Builder
    System.MissingMethodException
    No parameterless constructor defined for this object.
    621279de-dc1e-4000-820f-dfb1cdb3bcc0

    System.MissingMethodException: No parameterless constructor defined for this object. at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Activator.CreateInstance(Type type) at LogicBase.Components.FormBuilder.AdvancedComponents.GridView.GridViewColumnRendererFactory.GetColumnRenderer(AbstractGridViewColumnConfiguration columnConfiguration) in c:\build\projects\WF71MR2\components\LogicBase.Components.FormBuilder\Components\GridView\GridViewColumnRendererFactory.cs:line 18 at LogicBase.Components.FormBuilder.AdvancedComponents.GridView.GridViewComponentRenderer.Load() in c:\build\projects\WF71MR2\components\LogicBase.Components.FormBuilder\Components\GridView\GridViewComponentRenderer.cs:line 123 at LogicBase.Components.FormBuilder.Core.FormComponentRenderer`1.LogicBase.Components.FormBuilder.Core.IFormComponentRenderer.Load() in c:\build\projects\WF71MR2\components\LogicBase.Components.FormBuilder\Core\FormComponentRenderer.cs:line 135 at LogicBase.Components.FormBuilder.FormBuilderComponentRenderer.Load() in c:\build\projects\WF71MR2\components\LogicBase.Components.FormBuilder\FormBuilderComponentRenderer.cs:line 256 at LogicBase.Components.FormBuilder.FormBuilderComponent.LogicBase.Core.Models.Dialog.IAspNetPageComponent.Load(ComposerForm page) in c:\build\projects\WF71MR2\components\LogicBase.Components.FormBuilder\FormBuilderComponent.cs:line 475 at LogicBase.Core.Models.Dialog.ComposerForm.OnLoad(EventArgs e)


    So after playing around with it, I went for a plain old GridComponent marked as read only and that displays the data just fine... Seems to be an issue with my GridViewComponent - but I can't figure out what exactly it is. I'll try to reinstall Workflow later and see if that clears this up.

    Thanks again for all your help!



  • 6.  RE: Read Excel to Grid/Upload to DB

    Posted Jan 24, 2012 10:19 AM

    Yeah I have 1460 at home and 1400 here at the office, I'll rebuild it here at work and see if I get different results. 

     

    I don't see anything that stands out per se from the error message. Definitely weird though that the GridComponent works and GridView doesn't, maybe a bug or something. I'll check it out though and get back to you pretty quick.

     

    Glad you got it working in some form though!