BE_HTTP_GET_File returning text - function

I am trying to pull a csv file into my FM15 database from FTP using BE_HTTP_GET_File.
By using the BE_CurlTrace at the end of the script, I can see that connection to the FTP is always successful, however instead of grabbing the file and returning it to a container field or documents path (I have tried both unsuccessfully) the BE_CurlTrace output simply lists all the text in the file within the BE_CurlTrace output :/
Am I doing something wrong, I know my syntax is correct on the BE_HTTP_GET_File as I have used this before, and I'm also getting a successful connection, I just can't seem to get the actual file into a container or local filepath.
Any suggestions welcome.
Thanks

Use the BE_HTTP_GET function directly in the Set Field line. Don’t use the trace function like that, it’s for debugging.

Related

Access Link Text Wizard - Syntax error in PARAMETER clause

I'm trying to link to a text file from the Access Link Text Wizard (as I've successfully done hundreds of times before) but this time I'm getting an error stating
Syntax error in PARAMETER clause.
No parameterized query is being used so I'm at a bit of a loss, I'm only trying to link to a text file.
In Access 2016 I go to the External Data tab and click Text File. I browse to my tab-delimited text file and select the Link to the data source creating a linked table option. As soon as I click OK it gives me the error above.
My text file is very simple with 2 columns and about 100 rows of data. This file is created from a Stored Procedure in SQL Server 2016 using BCP. If I manually create a text file with test data using the same format I don't get the error, which leads me to believe it may be some data in the file causing the error? I can't figure out how to attach text files to my question so any suggestions are welcome.
EDIT: I copied all data from the offending file into a new text file and it linked properly so it's not the data. I am often creating text files from a SQL Server Stored Procedure then linking to it from Access. This is the first time I've experienced this particular error.
EDIT2: I recreated a text file manually with the same data from the offending file and named it the same this time (Procedure Class Listing.txt) and I got the error. Is something wrong with this title???
EDIT3: Sorry for so many edits. I tried naming the file without the spaces and it links properly. I have linked to files with spaces in the name before so I don't understand.
FINAL EDIT: So it appears that a text file starting with the word "Procedure" followed by a space is giving me this error. I can remove all spaces (ProcedureClassListing.txt) and it works fine (which is the solution I'm going with).
So it appears that a file starting with the word "Procedure" followed by a space is giving me this error. I can remove all spaces (ProcedureClassListing.txt) and it works fine (which is the solution I'm going with).

Unexpected end of JSON input with MongoDB Compass

I exported my local MongoDB Collections using the JSON file type on my pc. Then I wanted to import these Collections on my root server using MongoDB Compass.
Everytime when I try to export the Collection, it throws the following error:
That's how my JSON file looks like:
{..."settings":{"inventory":{"crate":{"$numberInt":"0"},"cratekey":{"$numberInt":"0"},"pickaxe":{"$numberInt":"0"},...}
(I don't know if it's relevant to answer this question but this JSON line is just 1/142000)
How can I fix this error?
TL;DR
You need to have 1 empty line at the very bottom of the json file.
Long version
I don't know if this will help your case, but I ran into a similar issue when trying to import json data. I had 1 document per line, but something was still wrong. I then exported a similar piece of data as json, and tried playing around with it to see what was causing the issue. It turns out that the json must have an empty line at the bottom. So let's say you have 1 document to import. You place the entire document onto the first line. Then you just hit enter and create the second line at the bottom. After this, my data was imported without a problem.
So the problem is you need to minify your json document. That is it should be in one line. So here's link to website where you will paste your json document on the left and get the minified document on the right. It worked for me. I hope this also helps you.
https://codebeautify.org/jsonminifier
I had exact same problem, apparently their should be one document per line.
However use https://studio3t.com/ it'll work fine.

Columns are not defined for this connection manager

When I open my flat file connection manager, I see a warning message:
Columns are not defined for this connection manager
How do I solve this issue, or is it even something I need to worry about?
Click "Columns" in the pane on the left and define the columns of your flat file.
I am doing an "online" course and during the steps of importing a flat file I also encountered it. I could not get it to work initially. Then I aborted the import and tried again and used the " as text qualifier (even though the columns in the file are separated). It worked and I could see the correct columns in preview.
I know this might sound dumb but in my case, I accidently saved the file as xlsb instead of csv. Saving the file as the correct file type resolved issue.

How to automate getting a CSV file from this website?

I've never worked with web pages before and I'd like to know how best to automate the following through programming/scripting:
go to http://financials.morningstar.com/ratios/r.html?t=GMCR&region=USA&culture=en_US
invoke the 'Export to CSV' button near the top right
save this file into local directory
parse file
Part 4 doesn't need to use the same language as for 1-3 but ideally I would like to do everything in one shot using one language.
I noticed that if I hover my mouse over the button it says: javascript:exportKeyStat2CSV(); Is this a java function I could call somehow?
Any suggestions are appreciated.
It's a JavaScript function, which is not Java!
At first glance, this may seem like you need to execute Javascript to get it done, but if you look at the source of the document, you can see the function is simply implemented like this:
function exportKeyStat2CSV(){
var orderby = SRT_keyStuts.getOrderFromCookie("order");
var urlstr = "//financials.morningstar.com/ajax/exportKR2CSV.html?&callback=?&t=XNAS:GMCR&region=usa&culture=en-US&cur=&order="+orderby;
document.location = urlstr;
}
So, it builds a url, which is completely fixed, except the order by part, which is taken from a cookie. Then it simply navigates to that url by setting document.location. A small test shows you even get a csv file if you leave the order by part empty, so probably, you can just download the CSV from the base url that is in the code.
Downloading can be done using various tools, for instance WGet for Windows. See SuperUser for more possibilities. Anyway, 'step 1 to 3' is actually just a single command.
After that, you just need to parse the file. Parsing CSV files can be done using batch, and there are several examples available. I won't get into details, since you didn't provide any in your question.
PS. I'd check their terms of use before you actually implement this.
The button directs me to this link:
http://financials.morningstar.com/ajax/exportKR2CSV.html?&callback=?&t=XNAS:GMCR&region=usa&culture=en-US&cur=&order=asc
You could use the Python 3 module urllib and fetch the file, save it using the os or shutil modules, then parse it using one of the many CSV parsing modules, or by making your own.

SSIS - "switchable" file output for debug?

In an SSIS data-flow task, I'm using a Multicast transform at a key part of the flow which I want to hang a File Output destination off.
This, in itself, is no problem to do. However I only want output in the file if I enable it; i.e., I'd be using it for debugging the data if the flow fails unexpectedly and it's not immediately obvious from the default log message output why this occured.
My initial thought was to create a File Output whose output file was obtained from a variable, and by default, the variable would contain 'nul' - i.e., the Windows bit-bucket - which I could override through configuration in the event of needing to dig further.
Unfortuantly this isn't working: the File Output complains saying that "The filename is a device or contains invalid characters". So it looks like I can't use the bit-bucket.
Is anyone aware of a way to make output "switchable"? This would make enabling debug a less risky proposition than editing the package and dropping a File Output in directly.
I suppose I could have a Conditional Split off the multi-cast which basically sends output if a variable is set to some given value, but this seems overly messy, I'll be poking other options, but if anyone has any suggestions/solutions, they'd be welcome.
I'd go for the conditional split, redirecting rows to the konesans trash destination adaptor if your variable wasn't set, otherwise send to your file.