Solved

Processing Export Scenario error using Generic Inquiry provider type

  • 18 February 2022
  • 3 replies
  • 383 views

Userlevel 6
Badge +3

I created an Export Scenario and when I view the Screen from the Export Scenario screen it shows me exactly what I am expecting.  (Thanks Naveen)

However, when I try to Process Export Scenario, I get an error.

The data gets “prepared” and this is exactly what I am wanting to export:

In case it helps, here is the definition of the data provider and Export Scenario

PARAMETERS

SCHEMA 

 EXPORT SCENARIO

The source of the data is from a Generic Inquiry.

For CSV provider, you have to link a file and that file name is used to create the export file.  I don’t see that file link option in the Generic Inquiry Provider type, so maybe it just doesn’t know what file to export to?

Any ideas what that error is caused by?

Thanks,

Joe Schmucker

 

icon

Best answer by Joe Schmucker 18 February 2022, 21:41

View original

3 replies

Userlevel 7
Badge +6

@joe21 , your data provider must be a CSV type, and not a generic inquiry.

In order to do that

  1. On the Data Providers screen, create a new Data Provider, give it a name, set the type of the Data Provider to CSV.
  1. Then click File on the top right corner of the screen.
  1. Upload csv template.
  1. Go to SCHEMA tab, FILL SCHEMA OBJECTS, activate, FILL SCHEMA FIELDS.
  1. Save this Data Provider.
  1. Go ahead and replace the Data Provider in your Import Scenario. You might need to re-map it.

It will do the trick for you.

Userlevel 6
Badge +3

I originally created it using CSV provider type.  I am using a SQL view to create a single returned field containing a string.  It is in the format required by the bank.  I used a CSV template file with one field so the output is fine as long as there are no commas in the output string.

The problem with using the CSV type is that if the company name has a comma in it, the field is surrounded with Quotes.  The output file cannot have quotes and must be an exact length.

Since this is a “positive pay” file to send to the bank, the payee name in the file must match exactly to what is printed on the check.  

I thought about replacing the commas in the string with a period (in the SQL View) but I don’t know yet if the bank will accept that.  

I contemplated creating a new data provider via code per Sergey’s post here: https://asiablog.acumatica.com/2016/09/custom-integration-services-data.html

But I think that is beyond my skill set.  The example he provided is based on CSV.  I *might* be able to do it if I had that code based on an ACH provider as a starting point.

I am able to get the output I want using a SQL View as the table for my GI.  I am just missing the ability to export the results from the GI to a text file without any additional formatting being applied by Acumatica.  

I have tried setting up this scenario using other provider types with no success.  I even tried SQL provider type but I got an error that “company ID” cannot be null when I ran the export.

Something this simple should not be so hard.  :-)  Creating a provider from scratch might be the only option I guess.  But as I said, without an example code base, I’d be lost.

 

Userlevel 6
Badge +3

I ended up writing a custom data provider.  I used the code from Sergey’s blog and modified a few lines.

In case anyone else needs to do what I am doing, this is what I did.  I also put a flag in to not write the line if the value of the record is the same as the field header name.  The Process Export Scenario screen refused to skip the header record even when the Skip Header was checked.

        public void Write(IEnumerable<string> values)
        {

            bool SkipHeader = false;

            int valuesCount = values.Count();
            string[] converted = new string[valuesCount];

            int i = 0;
            foreach (string item in values)
            {
                string value = item ?? String.Empty;

                if (value == "ResultLine") SkipHeader = true;
                
                //if (_quoteAll || (value.IndexOfAny(_QUOTED_SYMBOLS) >= 0) || value.Contains(_delimiter))
                    //value = QuoteItem(value);
                converted[i++] = value;
            }

            if (SkipHeader == false) {
                WriteLine(String.Join(_delimiter, converted.ToArray()));
            }
        }
 

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved