I need to Import *.srd files into a DW in run-time. I tried
LibraryImport, ImportString and another things but I can't.
It's so funny because using the IDE option 'Import...' appear a nice
Window dialog which let me import *.srd files into my project.
My application gets *.srd files from a database and saves in a
directory path. Then, assigns this new file (.srd extension) to a DW
control in run-time. Sometimes a *.srd file comes from a folder (not
into a database).
How could I do to make this dialog appears in run-time? or if someone
has a piece of code to help me, it would be great.
Thanks in advance!!!!
Sergio.
You would have to add that line to the file.
Another problem perhaps is the encoding used to save the file.
--
Terry Dykstra (TeamSybase)
http://powerbuilder.codeXchange.sybase.com/
http://casexpress.sybase.com
product enhancement requests:
http://my.isug.com/cgi-bin/1/c/submit_enhancement
"Sergio Lescano" <sergio...@gmail.com> wrote in message
news:bd999185-58af-4cac...@d77g2000hsb.googlegroups.com...
Good luck,
Terry [TeamSybase] and Sequel the techno-kitten
*********************************
Build your vocabulary while feeding the hungry
http://www.freerice.com
*********************************
Newsgroup User Manual
=====================
TeamSybase <> Sybase employee
Forums = Peer-to-peer
Forums <> Communication with Sybase
IsNull (AnswerTo (Posting)) can return TRUE
Forums.Moderated = TRUE, so behave or be deleted
*********************************
Sequel's Sandbox: http://www.techno-kitten.com
Home of PBL Peeper, a free PowerBuilder Developer's Toolkit.
Version 4.0.4 now available at the Sandbox
PB Futures updated June 25/2008
See the PB Troubleshooting & Migration Guides at the Sandbox
^ ^
o o
=*=
- To Terry Dyktra: I realised about that. I tryed with a *.srd
exported from Powerbuilder IDE and other from my container folder,
having same results.
I compared both files and they haven't got any diference into them.
When I use the 'Import...' function from Powerbuilder IDE, both files
were imported without problems and can see them into my project.
Greetings, Sergio.
libraryimport will compile datawindow syntax from a string variable
into a pbl.
If you want to import from a file you will need to read the file
contents into a string first.
So, getfileopenname can prompt the user for a file name. If you supply
an array variable, the user can select multiple files.
If you wan't to just grab every file in a folder, you can use the
FindFirst / FindNext win32 API functions. There are a bunch of
examples around for how to implement that.
fileopen / filereadex / fileclose can then read the contents into a
string variable.
Though you mentioned the files were stored in the database? if so you
could probably go straight from database to string variable to
libraryimport.
Also look at the datawindow create function, this can construct a
datawindow control directly from the syntax, so you may be able to
avoid compiling into a pbl as well.
What you end up doing really depends on your requirements.
- Do you want the DataWindow loaded into a PBL (LibraryImport()) for
later use, or instantiated in a control (Create() can do that). (If
you want LibraryImport(), I don't understand why you are storing them
on the file system as well) Basically, what is the end purpose of
these DataWindows?
- You talk about file names from the database, then about dialogs that
get file names from the user. Which is it? Or, are you after both?
- Jeremy picked up on something in a different way than I did: I
interpreted *.srd to be referencing a file type; Jeremy interpreted it
as possibly implying a requirement to get a list of files that match a
wildcard expression. Are you after a set of files matching a wildcard?
If you help us understand what you're after, maybe we can be more
precise in helping you.
Let us know,
Terry [TeamSybase] and Sequel the techno-kitten
*********************************
> - You talk about file names from the database, then about dialogs that
> get file names from the user. Which is it? Or, are you after both?
This in necesary when there aren't templates into the database to a
new item. Templates are created from scratch (a_template.srd) and
stored into a folder, then this template are linked by my application
(at this point is I need to import a_template.srd file).
> - Jeremy picked up on something in a different way than I did: I
> interpreted *.srd to be referencing a file type; Jeremy interpreted it
> as possibly implying a requirement to get a list of files that match a
> wildcard expression. Are you after a set of files matching a wildcard?
Sorry, my english is not good as I want(or think). May be I maid a
mistake when I asked for help.
I general words, I need to get templates files and link them to items
into a DataBase. This templates are obligatorily stored into a
DataBase (can't change this).
When a template doesn't exist, my application has to take the template
(with .srd extension) from a external folder and store into the
DataBase.
Application has to show the template in a DataWindow before the user
press 'Save button' to store into the DataBase.
I've been stucked in this last part, 'SHOW a .srd file in a
Datawindow'. I've tried everything but couldn't solve the problem yet.
Thanks again, and sorry for my bad english.
First read the .srd file into a string called ls_syntax and execute this
function:
dw_1.Create(ls_syntax)
Also, there is a Spanish PowerBuilder newsgroup if you are having problems
with English.
"Sergio Lescano" <sergio...@gmail.com> wrote in message
news:bb16295d-b056-448f...@f36g2000hsa.googlegroups.com...
dw_preview.hide()
dw_preview.reset()
if not isnull(ls_syntax) and ls_syntax<>'' then
dw_preview.create(ls_syntax)
dw_preview.object.datawindow.zoom = 100
dw_preview.insertrow(0)
else
dw_preview.Dataobject=''
end if
dw_preview.show()
and work perfectly.
Thanks !!!
** Note: Part of improve my English is write an read in English
forums. Sorry if I didn't ask as well as you need, thank you very much
to understand me.