PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → problem with filetomemorytable syntax
problem with filetomemorytable syntax
Iniciado por gallen.dbmc, 28,mar. 2016 19:45 - 6 respuestas
Miembro registrado
31 mensajes
Publicado el 28,marzo 2016 - 19:45
I have a table in my analysis called Capacity. I want to make a copy of it in memory. Should be simple but I'm rather new at WinDev.
The help says:
**************
FileToMemoryTable(<Table Name> , <File Name>)
<Table Name>: Character string (with or without quotes)
Name of the memory Table control to fill.
<File Name>: Character string (with or without quotes)
Name of the HFSQL data file, view or query used.
*****************
so I tried:
FiletoMemory(TBL_Cap, Capacity)
and got:
The identifier 'TBL_Cap' is unknown or inaccessible
so I first defined TBL_Cap as a Data Source (not sure about this but couldn't think of anything else)

Now it compiles successfully but when run it produces:
Error at line 27 of Global Procedure CalcCap process.
FileToMemoryTable function called.
Error caused by 1 parameter.
The 'TBL_Cap' control is unknown.

I've been reading hints on this website for hours and I still can't figure out what I am doing wrong.

--
Garry
Publicado el 29,marzo 2016 - 13:09
Hi garry,

Table means one type of control in one windows not one database table.
If you need one copy in memory (data source) you can use one query.
Publicado el 29,marzo 2016 - 13:29
Hi Garry,

the first thing, to be sure we are all talking about the same thing, is
to use the windev naming convention. in it a table is a control that
goes in a window. A file is described in the analysis.

So you have a FILE called capacity, and a table control called Tbl_Cap
somewhere in a window.

one thing you are not telling us is WHERE you are doing things...

Where did you put your table control? Is the code causing problem in
that same window? If not, you need to prefix the table name with the
window name (MyWindow.TBL_Cap)

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Ready for you: WXShowroom.com, WXReplication (open source) and now WXEDM
(open source)

More information on http://www.fabriceharari.com


On 3/28/2016 11:45 AM, Garry ALLEN wrote:
I have a table in my analysis called Capacity. I want to make a copy of
it in memory. Should be simple but I'm rather new at WinDev.
The help says:
**************
FileToMemoryTable(<Table Name> , <File Name>)
<Table Name>: Character string (with or without quotes)
Name of the memory Table control to fill.
<File Name>: Character string (with or without quotes)
Name of the HFSQL data file, view or query used.
*****************
so I tried:
FiletoMemory(TBL_Cap, Capacity)
and got:
The identifier 'TBL_Cap' is unknown or inaccessible
so I first defined TBL_Cap as a Data Source (not sure about this but
couldn't think of anything else)

Now it compiles successfully but when run it produces:
Error at line 27 of Global Procedure CalcCap process.
FileToMemoryTable function called.
Error caused by 1 parameter.
The 'TBL_Cap' control is unknown.

I've been reading hints on this website for hours and I still can't
figure out what I am doing wrong.

--
Garry
Miembro registrado
31 mensajes
Publicado el 29,marzo 2016 - 16:14
Thank you Fabrice. The "language barrier" does indeed seem to be at least part of the problem.
You are right - I have a file called Capacity. ('Table' is so ingrained in my mind that I had to re-type that).
I was attempting to write a Procedure to fill the file and since I had no intention of displaying the data in the procedure I never thought of the 'table' as being a visual control .
Capacity.fic is actually more of a template - it contains 3 fields:
Tour_Time -a 5 char string eg 11:00
TCap - an integer which holds the remaining Tour Capacity
RCap - an integer which holds the remaining Restaurant Capacity
There are 15 records in the file
A workstation calls the Procedure passing a Tour date and Boat ID and a query on the Reservation file fills in the table.
In my previous version of the program in xBase++ I used temporary files (like 'CAP01' where the 01 is the station number) to accomplish this but I thought WinDev's memory table would work.
My guess is that I will also have to pass the name of a table control to the procedure but I am unsure of how to do that since the actual control's content hasn't been calculated yet. Maybe I should be using an associative array instead of a memory table?
I hope I have explained this sufficiently well.
Garry
PS I purchased your OOP 2013 last week... very good
Publicado el 29,marzo 2016 - 16:55
Hi Garry,

I'm confused,
A workstation calls the Procedure passing a Tour date and Boat ID and a
query on the Reservation file fills in the table.


So you already have a query to fill the table... What do you need a
temporary file for?

> I hope I have explained this sufficiently well.

Maybe, but I did not get it, sorry :-)
Garry
PS I purchased your OOP 2013 last week... very good


Good to hear..
Miembro registrado
31 mensajes
Publicado el 29,marzo 2016 - 20:04
Damn - I did it again!
'...a query on the Reservation file fills in the table' should say:
a query on the Reservation file updates the file.

--
Garry
Publicado el 29,marzo 2016 - 23:05
Hey Garry, we'll get there :-)

If I take back your FIRST statement:
>>I have a table in my analysis called Capacity. I want to make a copy
of it in memory. Should be simple but I'm rather new at WinDev.

and "translate it":
I have a file called capacity. I want to make a copy of it in memory.

To do that, you can simply create a query in the query editor (select
all, basically) and run it via hexecutequery

At this point, the content of the query (in memory) is a copy of your file.

Why you would want to do that, I don't know, but if THAT is what you
wanted, it's quite simple indeed

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Ready for you: WXShowroom.com, WXReplication (open source) and now WXEDM
(open source)

More information on http://www.fabriceharari.com

On 3/29/2016 12:04 PM, Garry ALLEN wrote:
Damn - I did it again!
'...a query on the Reservation file fills in the table' should say:
a query on the Reservation file updates the file.

--
Garry