Normal Topic Limiting Imports (Read 523 times)
BWETTLAUFER
Full Member
***
Offline



Posts: 216
Location: Cambridge, Ontario
Joined: Apr 9th, 2010
Limiting Imports
Sep 15th, 2016 at 7:09pm
Print Post Print Post  
Hey folks ... me again.

I'm now trying to build a mass update button to run imports ... however, every time I run it through the code below, I get an import error -- see administrative log for details message.

Can anyone see if I'm missing something obvious here?

Code
Select All
#include "sbasic_include.sbas"

stat vSpecList as String
stat vSpec as String
stat vResult as String
stat vDestination as String
stat vRun as int
stat vStaff as string
stat vSpec1 as string
stat vSpec2 as string
stat vSpec3 as string

vSpec1 = @SpecCommand(6, 4, "")				// Get a list of saved Mass Update specs
vSpec1 = @SortStringArray(vSpec1, 0)			// Sort them

If vSpec1 = ""						// Make sure there is at least one spec to show in popup list
	@MsgBox("No saved Import specs found!", "", "(HINT: Save one first)")
Else
{
	if @group <> "Management"
	{
		vStaff = @xlookup(@FN, @userid, "Staff Screen!StaffRef", "StaffMU")
		vSpec2 = @containsstringarray(vSpec1,vStaff,0)
		vSpec2 = @sortstringarray(vSpec2,0)
		vSpec3 = @Popupchoicelist(vSpec2,"CHOOSE AN IMPORT")
	}
	Else
	{
		vSpec2 = vSpec1
		vSpec2 = @sortstringarray(vSpec2,0)
		vSpec3 = @Popupchoicelist(vSpec2,"CHOOSE AN IMPORT")
	}

	// vSpec3 = @PopupChoiceList(vSpec3, "CHOOSE AN IMPORT")	// Display the list of specs
	If vSpec3 <> ""						// Make sure a spec name was selected
	{
		vDestination = @PromptForUserInput("File Import Location?","S:\Data\Import\" + DBCltNo + "export" + @num(@serverdate()) + ".csv")

		If FileExists(vDestination)
		{
			Writeln("IMPORTING FILE")
			Writeln(vSpec3)

			vResult = @SpecCommand(SPEC_OPERATION_LOAD, SPEC_TYPE_IMPORT, vSpec3)		// LOAD the Mass Update spec
			vResult = @SpecCommand(SPEC_OPERATION_RUN, SPEC_TYPE_IMPORT, vSpec3)		// RUN the Mass Update spec
		}

	}
}
 

  
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Limiting Imports
Reply #1 - Sep 16th, 2016 at 3:13am
Print Post Print Post  
The import error sounds like you might have a problem with the structure of the import file.


On an unrelated note:
You have static variables. Are you running this in global code?
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged