I need filename because it has information I don't have in file context.
I already have the related column in my DB.
How to get filename as a column's values?
in your input configuration there is a section called "Additional output fields", there you must go to "Short Filename Field" and select ${Internal.Tranformation.Filename.Name}
then you cant test it on Preview Rows.
Related
Can anyone tell me how I can get my URL text to show up as the the "IMAGE NAME" in my query? I am using Toad Data Point SQL Builder and this is what I have so far
SELECT
ast.location,
ast.assetnum,
ast.description,
own.alnvalue AS "OWNED BY",
di.description AS "IMAGE NAME",
concat ('http://link_here', substr(di.URLNAME, 25)) as Link
I then get the Image name and Link in two different columns, but would like to have the Link text show as the "Image Name". Also once I export the query results to an excel instance can I have the Link display as a Hyperlink without having to do one by one?
You're only 50% lucky, which is quite a lot in this case.
Don't bother about displaying "Image name" as the result - it just won't happen. Result of a SQL statement is pure text, unless you use some tool which lets you format data (such as Oracle Apex).
However, your 50% luck comes with exporting data to Excel, with working URLs. Here's how:
run a query which uses Excel's hyperlink function
see the result; right-click it, choose "Export dataset"
export to "Excel instance"; make sure to set options just like I did.
pay attention to "Treat string fields as strings" that option should NOT be checked
the result is as you wanted it - clickable URLs
I'm trying to build a program that gets users name at first. This user names are kept in a text file. After user logins, according to the user's name, I want user to be lead his/her specific informations. I figured out that I can only do it with a file that is created when he sign up for an account which I direct him with my sign up button in Livecode. While he/she create his account I want to create a specific file for his/her. Can you help me with it please?
PS: I don't want to do it with a database right now. I just want to learn how to create a file without a specific name like
put specialFolderPath("documents")&"/userLoginCridentials.txt" into tFile put URL("file:"&tFile) into myFile
Instead of this "userCridentials.txt" I want something user can create with his own name :)
Having a little problem to understand your question. Are you targeting mobile or desktop? Are you having problem saving or reading the data?
If saving is you problem
On desktop you can use:
ask file "Save file as:"
then you get the filename back in it so you can use:
if it is not empty then
# We have a complete file path in 'it'
put it into tFile
put tData into url ("file:" & tFile)
end if
If you targeting mobile and would like to save into the specialFolderPath("Documents")you can get the filename from a field and then save to that file. E.g. if you have a field named 'fileName' you can use something like:
put tData into url("file:" & specialFolderPath("Documents") & "/" & field "fileName"
Of course you should do some error checking to ensure that a user don't overwrite existing files without at least asking for permission, etc.
You can of course use a variable instead of a field...
If reading data is your problem
On desktop you can use:
answer file "Open File:"
Same as above but you now read data instead:
if it is not empty then
# We have a complete file path in 'it'
put it into tFile
put url ("file:" & tFile) into tData
end if
on mobile you probably would like to present a list with the user-created files. In LiveCode you can list all files in the defaultFolder with the files. But you must set the defaultFolder to the folder you want to list.
set the defaultFolder to specialFolderPath("Documents")
put the files into tFiles
Now tFiles contains every file in that folder and you can filter it, display it in a list etc. E.g:
filter tFiles with "*.txt"
put tFiles into
If your problem is how to remember the "current" file name
Whenever you restart your app every variable is reset. So everything you want to remember between runs needs to be saved before your app quits. And for that you need a predefined filename. SO then your procedure will be:
Read in the predefined file.
Grab the file name from within that file
Read the file
If your problem is something else
Sorry, then I misunderstood your question...
I am on a restricted corporate network and I have some trouble programmatically exporting a CSV file from a query. The following command:
DoCmd.TransferText acExportDelim, , "query_name", strPath
tries to export a CSV with a comma [ , ] as delimeter. This results in an error since it equals the decimal separator in my region. Somehow the windows localization settings are not applied correctly in this case. The Excel "save as..." command does give a proper CSV file with [ ; ] delimiter.
Following from this post, I tried to create a specification (SpecName) to apply the semicolon. The dialog box prevented me from unchecking all boxes and saving a specification was not an option. My guess is that this is due to restrictions on my account.
So, the local settings are not applied properly and a custom specification is out of the question. What are my options here?
Two approaches are possible here:
Roll your own csv-Export. It's not too difficult. Open your Query to obtain a Recordset, then iterate over rows with Do While Not rs.EOF and over Fields with For Each myField In rs.Fields and concatenate the data into a String. With this, you can specify your own separators and quotes around the values, if you have the separator inside the values.
Create an Excel-Instance and copy the recordset into a sheet using Worksheet.QueryTables.Add(). Then you can use Worksheet.SaveAs sCSVName, xlCSVWindows to write that to a csv-file.
I am getting the output in flat file as shown below.
How do I avoid column names from being written to the flat file output?
The best way that I've found to accomplish this is the following:
I create a test output flat file. I populate the .txt file with the result set from the SQL query that will be used in the package. Make sure that the first row of the .txt file contains the column header names.
Create a Flat File Connection. Point it to the text output flat file. Check the "Column names in the first data row" box. This will make sure that the actual column header names will be used/shown, instead of "Column 0", "Column 1", etc. Click "OK" to close the Flat File Connection Manager.
Edit the Flat File Destination item to make sure that the actual column header names are picked up and that the fields are mapped properly between your query and the output columns of your Flat File Connection. Click "OK".
Highlight the Flat File Connection and press "F4" to open the "Properties" window. There, change the "ColumnNamesInFirstDataRow" to "False".
Now your output flat file will contain data only...no column header row. Yet you can still go to the Flat File Destination item and see the actual column header names being used there.
Avoiding column names in the flat file output:
Double-click the Flat File Connection Manager to open the Flat File Connection Manager Editor
On the Flat File Connection Manager Editor, uncheck the box Column names in the first data row.
This will prevent flat file connection manager from writing the column names to the flat file output.
If you already have header in the file - you can simply skip the first row. See screenshot from #user756519 answer.
Set Header rows to skip to 1
I have some contract text that may change.
It is currently (non live system) stored in a database field (we determine which contract text to get by using other fields in table). I, however need to display a specific date (based on individual contract) within this text.
IE (but Jan 12, changes depending on the individual contract):
blah blah blah... on Jan 12, 2009... blah blah blah
but everything else in the contract text is the same.
I'm looking for a way to inject the date into this text. Similar to .NET's
Console.Write("Some text here {0} and some more here", "My text to inject");
Is there something like this? Or am I going to need to split the text into two fields and just concatenate?
I am always displaying this information using Crystal Reports so if I can inject the data in through Crystal then that's fine.
I am using Crystal Reports, SqlServer 2005, and VB.net.
You could use some "reserved string" (such as the "{0}") as part of the contract, and then perform a replace after reading from the database.
If there's no option for this reserved string (for instance, if the contract may contain any type of string characters in any sequence, which I find unlikely), then you'll probably need to split into 2 text fields
Have you tried putting a text marker like the {0} above that can be replaced in the crystal reports code?
You can create a formula field and concatenate your text there.
If the data is stored in the database, the formula text should look like this:
"Some static text " & totext({yourRecord.yourDateField}, "yyyy")
Or you can provide it as a parameter before you show the report:
Dim parameterValue As New CrystalDecisions.Shared.ParameterDiscreteValue
value.Value = yourDate
Dim parameter As New CrystalDecisions.Shared.ParameterField
parameter.ParameterFieldName = "MyParam"
parameter.CurrentValues.Add(value)
parameter.HasCurrentValue = True
Me.CrystalReportViewer1.ReportSource = rapport
Me.CrystalReportViewer1.ParameterFieldInfo.Clear()
Me.CrystalReportViewer1.ParameterFieldInfo.Add(parameter)
Then the formula text should look like this:
"some static text " & {?MyParam}
I'm assuming you have a data source connected to your report. You can drag the field from the Database Explorer drop where it should appear. This way whenever the report runs the correct text will always be shown.