Join our DNN Community    (Newsletter, Tips, Tricks and Forums for DNN Skins & Modules)

 


 
Microsoft Gold Certified Partner - DNN Benefactor

DotNetNuke Powered! 


Thursday, November 20, 2008 Register · Login · Contact · Search:  
Company Solutions Portfolio Contact
Forums
Samples and other shared info.

Subject: Database Import and File Upload Example

You are not authorized to post a reply.   
Page 2 of 3 << < 123 > >>
Author Messages
kevinmschreiner
Please Wait...
Posts:749

10/23/2006 8:47 AM Alert 
We're still working through a couple compatibility issues which are currently in beta phase. Once we clear the hurdle, the release will come out. We have a number of users already using the new version, and use it extensively. Our newsletter is coming out this week, and we are going to coincide that with the next release.

Kevin M Schreiner

Business Intelligence Force, Inc. (bi4ce)
rtonerii
Superweight
Posts:305

10/27/2006 3:37 PM Alert 
Any idea when the next release will be? It is like the end of the week
kevinmschreiner
Please Wait...
Posts:749

10/28/2006 10:30 AM Alert 
We had to delay the release due to a few other enhancements that were already under development for the new release. But alas - the release went out last night! 1.9 is available for download on Snowcovered. Thanks for your support!

Kevin M Schreiner

Business Intelligence Force, Inc. (bi4ce)
DavidWSnow
Cruiserweight
Posts:127

12/23/2006 6:06 PM Alert 
I just tried using Paul's example to load my database and found what I think may be a problem.
My database has about 25 fields. Thier names sometimes are extensions of another name
For example "Prov_First" for a "provider's first name and "Prov_FirstYr" for their 1st year of business.

In the "Insert into AFH (Prov_FirstYr ) VALUES (@Prov_FirstYr) it appears that ListX
expanded the @Prov_First to NULL from the value of @Prov_First rather than using the value of @Prov_FirstYr

Since the two fields were the name collieted could easily be changed I did that, but wonder if this is a quoting issue
or a bug.

I looked at the SQL that Evotiva BackupScript generated to insert data back into my database and noticed that they did it slightly different.
The example below has the strings truncated

ALTER TABLE [SiteLog] DISABLE TRIGGER ALL
ALTER TABLE [SiteLog] NOCHECK CONSTRAINT ALL
TRUNCATE TABLE [SiteLog]
GO
SET IDENTITY_INSERT [SiteLog] ON

INSERT INTO [SiteLog] ([SiteLogId],[DateTime)
VALUES(1,'2006-11-14 09:44:00.000')
GO

SET IDENTITY_INSERT [SiteLog] OFF
ALTER TABLE [SiteLog] CHECK CONSTRAINT ALL
ALTER TABLE [SiteLog] ENABLE TRIGGER ALL
GO

I suspect that if you really want to use this model for uploading real data on a regular basis some of the issues that Evotiva
addressed might have to be considered. However, this is a great way for simple databases. I did notice as I debugged
typos in my field names that had to be typed in at least 4 times that the ListX error handling could be more visable.
The only way to know that I had an error was to read the action/debug data.
tiggerz5
Featherweight
Posts:14

02/10/2007 4:27 AM Alert 
Anybody have an idea on how to execute an update query after a csv file has been uploaded? I've got the file to be uploaded and values inserted into a table. the next step that I want to do is perform an update based on a column value that was in the upload. I can't seem to get Listx to recognize the second action execute query.

here's the code:


0. If '[frmImport,Form]' = 'Import'

1. Execute Query[gd]: Select CAST(GETDATE() as float) as uniident


2. Assignment: Assign <Action> variable 'aUniIdent' to '[uniident,gd]'.


3. File: Source Variable: <Form> frmFile. DestinationPath[PORTALPATH,System]CBUD/[aUniIdent,A].[frmFile.Name,Form]


4. Execute Query[deleteRows]: Delete from sqlmaster.SMAXProjects


5. File: Source Variable: <Form> frmFile. DestinationSQL: INSERT INTO sqlmaster.SMAXProjects VALUES('' ,'' ,'' ,'' ,@vTaskNumber,@vTaskName','','','','',@vContractType,'','','','','','','','','','','','','',@vTaskStatus,'','','','','','','','','','' ,'' ,'' ,'' ,'' ,'' ,'' ,'' ,'' ,'','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','')Undefined


6. Assignment: Assign <Action> variable '[aUniIdent.Complete,action]' to Nothing.


7. Execute Query[UpdatetaskName]: UPDATE [sqlmaster].[SMAXProjects] SET [TaskName] = [TaskName] + ' - CSR' Where [ContractType] like 'T&M%'

here's the xml:

<?xml version="1.0" encoding="utf-16"?>
<xListSettings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<recordsPerPage>0</recordsPerPage>
<enableAlphaFilter>false</enableAlphaFilter>
<enablePageSelection>false</enablePageSelection>
<enableRecordsPerPage>false</enableRecordsPerPage>
<enableCustomPaging>false</enableCustomPaging>
<enableExcelExport>false</enableExcelExport>
<enableHide_OnNoQuery>false</enableHide_OnNoQuery>
<enableHide_OnNoResults>false</enableHide_OnNoResults>
<enableAdvancedParsing>false</enableAdvancedParsing>
<enableCompoundIIFConditions>false</enableCompoundIIFConditions>
<enableQueryDebug>false</enableQueryDebug>
<enableQueryDebug_Edit>false</enableQueryDebug_Edit>
<enableQueryDebug_Admin>false</enableQueryDebug_Admin>
<enableQueryDebug_Super>true</enableQueryDebug_Super>
<autoRefreshInterval />
<skipRedirectActions>false</skipRedirectActions>
<skipSubqueryDebugging>false</skipSubqueryDebugging>
<enableAdmin_Edit>true</enableAdmin_Edit>
<enableAdmin_Admin>false</enableAdmin_Admin>
<enableAdmin_Super>false</enableAdmin_Super>
<enableAJAX>false</enableAJAX>
<enableAJAXCustomPaging>false</enableAJAXCustomPaging>
<enableAJAXCustomStatus>false</enableAJAXCustomStatus>
<includeJavascriptUtilities>false</includeJavascriptUtilities>
<includeJavascriptValidation>false</includeJavascriptValidation>
<javascriptOnComplete />
<enableMultipleColumnSorting>false</enableMultipleColumnSorting>
<ModuleCommunicationMessageType />
<showAll>true</showAll>
<useExplicitSystemVariables>false</useExplicitSystemVariables>
<searchItems />
<queryItems />
<listItems />
<messageItems>
<anyType xsi:type="MessageActionItem">
<Index>0</Index>
<ActionType>Condition-If</ActionType>
<ActionInformation>7:18;1;8;'[frmImport,Form]'='Import'</ActionInformation>
<Level>0</Level>
</anyType>
<anyType xsi:type="MessageActionItem">
<Index>1</Index>
<ActionType>Action-Execute</ActionType>
<ActionInformation>7:2;43;5;gdSelect CAST(GETDATE() as float) as uniidentFalse</ActionInformation>
<Level>1</Level>
</anyType>
<anyType xsi:type="MessageActionItem">
<Index>2</Index>
<ActionType>Action-Assignment</ActionType>
<ActionInformation>11:8;9;13;5;1;<Action>aUniIdent[uniident,gd]False0</ActionInformation>
<Level>1</Level>
</anyType>
<anyType xsi:type="MessageActionItem">
<Index>3</Index>
<ActionType>Action-File</ActionType>
<ActionInformation>13:8;6;7;4;57;0;Variable<Form>frmFilePath[PORTALPATH,System]CBUD/[aUniIdent,A].[frmFile.Name,Form]</ActionInformation>
<Level>1</Level>
</anyType>
<anyType xsi:type="MessageActionItem">
<Index>4</Index>
<ActionType>Action-Execute</ActionType>
<ActionInformation>8:10;34;5;deleteRowsDelete from sqlmaster.SMAXProjectsFalse</ActionInformation>
<Level>1</Level>
</anyType>
<anyType xsi:type="MessageActionItem">
<Index>5</Index>
<ActionType>Action-File</ActionType>
<ActionInformation>23:8;6;7;3;4;159;340;4;24;Variable<Form>frmFileSQLTrue12:37;33;38;36;15:1;0;12;6;0;0;0;4@vTaskNumberNumber15:1;0;10;4;0;0;0;5@vTaskNameText15:2;0;14;4;0;0;0;10@vContractTypeText15:2;0;12;4;0;0;0;24@vTaskStatusTextINSERT INTO sqlmaster.SMAXProjects
VALUES('' ,'' ,'' ,'' ,@vTaskNumber,@vTaskName','','','','',@vContractType,'','','','','','','','','','','','','',@vTaskStatus,'','','','','','','','','','' ,'' ,'' ,'' ,'' ,'' ,'' ,'' ,'' ,'','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','')True[ImportInstance,session]</ActionInformation>
<Level>1</Level>
</anyType>
<anyType xsi:type="MessageActionItem">
<Index>6</Index>
<ActionType>Action-Assignment</ActionType>
<ActionInformation>11:8;27;0;5;1;<Action>[aUniIdent.Complete,action]False0</ActionInformation>
<Level>1</Level>
</anyType>
<anyType xsi:type="MessageActionItem">
<Index>7</Index>
<ActionType>Action-Execute</ActionType>
<ActionInformation>11:14;109;4;0;UpdatetaskNameUPDATE [sqlmaster].[SMAXProjects]
SET [TaskName] = [TaskName] + ' - CSR'
Where [ContractType] like 'T&M%'
True</ActionInformation>
<Level>2</Level>
</anyType>
</messageItems>
<query />
<filter />
<customConnection />
<listItem />
<listAItem />
<defaultItem />
<noqueryItem><table>
<tr>
<td class=normalred>
File:
</td>
<td class=normalred>
<input type=file id=frmFile name=frmFile>
</td>
<td class=normal>
<input type=submit id=frmImport name=frmImport value=Import>
</td>
</tr>

</table></noqueryItem>
<Version>17</Version>
</xListSettings>
Michelle
Welterweight
Posts:43

07/17/2007 11:19 AM Alert 
Does this only works for dnn database?

I tried Paul's example. It works if the table is in the dnn database. Where can I connect to another database? The Custom Connection doesn't work. File has been saved, but there is no data in the table.

Michelle Chan
rgallais
Cruiserweight
Posts:147

07/18/2007 9:39 AM Alert 
Hi Michelle,

This should work. There is no restriction to call another database using the custom connection. Do you have any error message?

Romain Gallais
Business Intelligence Force, Inc. (bi4ce)
Michelle
Welterweight
Posts:43

07/20/2007 8:41 AM Alert 
Hello Romain

An error occurred:
# 5161FILTERFIELD:
# 5161FILTERTEXT:
# 516:_MessageActionItem_File_ColumnMappings: Unable to parse value.

Here is the xml:

<?xml version="1.0" encoding="utf-16"?>
<xListSettings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<recordsPerPage>0</recordsPerPage>
<enableAlphaFilter>false</enableAlphaFilter>
<enablePageSelection>false</enablePageSelection>
<enableRecordsPerPage>false</enableRecordsPerPage>
<enableCustomPaging>false</enableCustomPaging>
<enableExcelExport>false</enableExcelExport>
<enableHide_OnNoQuery>false</enableHide_OnNoQuery>
<enableHide_OnNoResults>false</enableHide_OnNoResults>
<enableAdvancedParsing>true</enableAdvancedParsing>
<enableCompoundIIFConditions>false</enableCompoundIIFConditions>
<enableQueryDebug>false</enableQueryDebug>
<enableQueryDebug_Edit>false</enableQueryDebug_Edit>
<enableQueryDebug_Admin>true</enableQueryDebug_Admin>
<enableQueryDebug_Super>false</enableQueryDebug_Super>
<enableQueryDebug_Log>false</enableQueryDebug_Log>
<enableQueryDebug_ErrorLog>false</enableQueryDebug_ErrorLog>
<autoRefreshInterval />
<skipRedirectActions>false</skipRedirectActions>
<skipSubqueryDebugging>false</skipSubqueryDebugging>
<enableAdmin_Edit>true</enableAdmin_Edit>
<enableAdmin_Admin>false</enableAdmin_Admin>
<enableAdmin_Super>false</enableAdmin_Super>
<enableAJAX>false</enableAJAX>
<enableAJAXCustomPaging>false</enableAJAXCustomPaging>
<enableAJAXCustomStatus>false</enableAJAXCustomStatus>
<enableAJAXManual>false</enableAJAXManual>
<includeJavascriptUtilities>false</includeJavascriptUtilities>
<includeJavascriptValidation>false</includeJavascriptValidation>
<javascriptOnComplete />
<enableMultipleColumnSorting>false</enableMultipleColumnSorting>
<ModuleCommunicationMessageType />
<showAll>true</showAll>
<useExplicitSystemVariables>false</useExplicitSystemVariables>
<enabledForcedQuerySplit>false</enabledForcedQuerySplit>
<searchItems />
<queryItems />
<listItems />
<messageItems>
<anyType xsi:type="MessageActionItem">
<Index>0</Index>
<ActionType>Action-Assignment</ActionType>
<ActionInformation>12:9;14;24;5;1;<Session>ImportInstance[ImportInstance,Session]False2</ActionInformation>
<Level>0</Level>
</anyType>
<anyType xsi:type="MessageActionItem">
<Index>1</Index>
<ActionType>Condition-If</ActionType>
<ActionInformation>7:24;1;8;'[frmImportPlayer,Form]'='Import'</ActionInformation>
<Level>0</Level>
</anyType>
<anyType xsi:type="MessageActionItem">
<Index>2</Index>
<ActionType>Action-Execute</ActionType>
<ActionInformation>9:5;44;5;0;qryIdSelect CAST(GETDATE() as bigint) as uniIdentFalse</ActionInformation>
<Level>1</Level>
</anyType>
<anyType xsi:type="MessageActionItem">
<Index>3</Index>
<ActionType>Action-Assignment</ActionType>
<ActionInformation>11:8;9;16;5;1;<Action>aUniIdent[uniIdent,qryId]False0</ActionInformation>
<Level>1</Level>
</anyType>
<anyType xsi:type="MessageActionItem">
<Index>4</Index>
<ActionType>Action-File</ActionType>
<ActionInformation>14:8;6;13;4;57;0;Variable<form>>frmFilePlayerPath[*PORTALPATH][aUniIdent,Action]_[frmFilePlayer.Name,Form]</ActionInformation>
<Level>1</Level>
</anyType>
<anyType xsi:type="MessageActionItem">
<Index>5</Index>
<ActionType>Action-File</ActionType>
<ActionInformation>24:8;6;13;3;4;112;149;4;24;Variable<form>>frmFilePlayerSQLTrue6:51;53;16:0;13;15;4;0;0;0;PlayerPhoneNr@vPlayerPhoneNrText16:0;14;16;4;0;0;0;PlayerLanguage@vPlayerLanguageTextINSERT INTO Players (Player_R_Date, Player_M_Date, Player_PhoneNr, Player_Language)
VALUES (getDate(), getDate(), @vPlayerPhoneNr, @vPlayerLanguage)TrueImport[aUniIdent,Action]</ActionInformation>
<Level>1</Level>
</anyType>
</messageItems>
<query />
<filter />
<customConnection>Provider=SQLOLEDB;Data Source=(local);Initial Catalog=TestMobCoupData;</customConnection>
<listItem />
<listAItem />
<defaultItem />
<noqueryItem><table border="0" cellpadding="4" cellspacing="0" STYLE="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 0.8em; font-weight: normal;">
<tr>
<td>
File:
</td>
<td>
<input type=file id=frmFilePlayer name=frmFilePlayer>
</td>
<td class=normal>
<input type=submit id=frmImportPlayer name=frmImportPlayer value=Import>
</td>
</tr>
</table></noqueryItem>
<SearchQuery />
<SearchTitle />
<SearchLink />
<SearchAuthor />
<SearchDate />
<SearchKey />
<SearchContent />
<SearchDescription />
<Version>17</Version>
</xListSettings>

Michelle Chan
rgallais
Cruiserweight
Posts:147

07/20/2007 10:41 AM Alert 
Hi Michelle,

We believe that is may be due the data type for the column mapping from CSV column that you are trying to use.
We will contact you directly in order to try and reproduce this issue.

Romain Gallais
Business Intelligence Force, Inc. (bi4ce)
Michelle
Welterweight
Posts:43

07/25/2007 4:52 AM Alert 
Hi Romain

The mapping type is text, the type of this field is varchar(50) and the text in CSV is the follow:

PlayerPhoneNr,PlayerLanguage
+41999999999,de
+41888888888,de
+41777777777,de

I tried with text like:

PlayerPhoneNr,PlayerLanguage
abc,de
def,de
xyz,de

That doesn't work either.
What data type does match with varchar(50)? There is not much to choose (Number, Decimal, Text, Date, Time, DateTime).

Thanks for help.

Michelle Chan
Michelle
Welterweight
Posts:43

08/22/2007 7:37 AM Alert 
How can I restrict the type of the upload file? Only csv-files should allow.

It doesn't work with <input type=file id=frmFile name=frmFile accept=text/comma-separated-values>.

Michelle Chan
Michelle
Welterweight
Posts:43

08/22/2007 8:42 AM Alert 
I gave up. Can't use ListX for my purpose.

I need to check the csv file first. There may be wrong title or wrong data...

This is good for small tables and if I'm the only person who use it.

Thanks for helping.

Michelle Chan
pmanda
Superweight
Posts:267

08/22/2007 11:08 AM Alert 
Hi Michelle,

You can refer to the documentation for the File upload at page 161.
Check the condition if the file type is csv, [frmFile.Type,form] ='csv' in the actions before you perform other actions.



Praveena Manda
Software Engineer
Bi4ce,Inc
Michelle
Welterweight
Posts:43

08/22/2007 2:46 PM Alert 
Hi praveena

That doesn't work:

* If '[frmFile.Type,Form]' = 'csv'
o 'application/vnd.ms-excel' = 'csv' = False
o Failed: Skipping child actions.

The word files are imported even if I refer with '[frmFile.Type,Form]' = 'application/vnd.ms-excel'.

Michelle Chan
pmanda
Superweight
Posts:267

08/23/2007 11:55 AM Alert 
Hello Michelle,
I send you an email which works for me . Let me know if you find any problems.

Praveena Manda
Software Engineer
Bi4ce,Inc
Michelle
Welterweight
Posts:43

09/20/2007 9:53 AM Alert 
Thanks Praveena, but don't understand your email. What does this mean:

<div class='NTForums_Quote'>Check with this configuration. It worked for me. Thanks,, Praveena, 0 false false false false false false false true true false false false false false false false false true false false false false false false false false false false false false 0 Message 4:6;6;SubmitSubmit 0 1 Condition-If 8:21;1;17;'[frmFile.Type,form]'='application/csv' 1 <div><input name=frmFile id=frmFile type=file ></div> <div><a {ACTION,Submit,Submit,,M}>Submit</a></div> 17</div>

I still cannot use this. It works only if the title is correctly written. But a normal user can write something else.

How can I check the file bevor I import it?

Michelle Chan
pauldes
Immortal
Posts:1392

09/22/2007 5:48 PM Alert 
Have you tried doing:
If '[frmFile.Extension,Form]' = '.csv'
or
If '[frmFile.Extension,Form]' = 'csv'

I don't remember if you need the dot in the evaluation but one of those 2 should work.

ListX....makes you look brilliant, even though you're not.
Michelle
Welterweight
Posts:43

09/24/2007 2:31 AM Alert 
Thanks paul

But not csv is the problem. I have for example:

number,address,language

If I import number,address,lang

It imports, but the language is null. It should not import, if the title is wrong.

Michelle Chan
pauldes
Immortal
Posts:1392

09/24/2007 7:10 AM Alert 
It should not import the whole file or it should not import that single column?

ListX....makes you look brilliant, even though you're not.
Michelle
Welterweight
Posts:43

09/24/2007 7:16 AM Alert 
The whole file.

Btw If '[frmFile.Extension,Form]' = 'csv' works without dot.

Michelle Chan
You are not authorized to post a reply.
Page 2 of 3 << < 123 > >>

Forums > Bi4ce.Modules.ListX > Samples and other shared info. > Database Import and File Upload Example



ActiveForums 3.6
Latest Post
 
At R2integrated (formerly Bi4ce), we take support seriously.  That's why we support our customers and DNN community with daily monitoring from our experienced engineering team.  We ask that the first step taken is to read the relevant documentation and support forums prior to submitting any questions that may already be available or have been answered.  We ask that you review the documentation that we provide for our products before posting a question.

The Forums are for our customers to chat, exchange ideas and strategies, and submit feedback.  Please be sure to perform keyword searches for previous related forum responses.

To be helpful when submitting a new item, please include the following: 
  1. DNN Version
  2. Module Version
  3. Admin Log Viewer Information
  4. Environment detail: Operating system, .NET framework version, database and version, IIS version, Browser version (if appropriate)
We always try to respond quickly and monitor the forums daily during business hours (EST).  Occasionally, requests for a specific project requirement may not apply for the free support offered. For project specific support please submit via our Information Request form.

Thank you for using our Forums.

Click here to register for the Forums
 
© 2008 by R2integrated (formerly Bi4ce) | DNN® is a registered trademark of DotNetNuke Corporation