dbTalk Databases Forums  

Query - insertTable

comp.databases.paradox comp.databases.paradox


Discuss Query - insertTable in the comp.databases.paradox forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
MA
 
Posts: n/a

Default Query - insertTable - 08-09-2006 , 03:07 PM






Does query.insertTable(TableToInsert, BeforeWhichTable) work at all ?

I have some saved queries and would like to :

query.readFromFile("queryFile.qbe")
query.insertTable( someTable, beforeThisTable)
query.setCriteria...

The syntax is:

insertTable ( const tableName String, const beforeTableName String )
SmallInt

and when I check the return value it is zero ( 0 ).

Thanks,
Anthony



Reply With Quote
  #2  
Old   
MA
 
Posts: n/a

Default Re: Query - insertTable - 08-09-2006 , 03:11 PM






I forgot to indicate that I would really like to insert a table above the
first table in the given query.

Thank you,
Anthony

"MA" <a@a.com> escribió en el mensaje
news:44da40a9 (AT) pnews (DOT) thedbcommunity.com...
Quote:
Does query.insertTable(TableToInsert, BeforeWhichTable) work at all ?

I have some saved queries and would like to :

query.readFromFile("queryFile.qbe")
query.insertTable( someTable, beforeThisTable)
query.setCriteria...

The syntax is:

insertTable ( const tableName String, const beforeTableName String )
SmallInt

and when I check the return value it is zero ( 0 ).

Thanks,
Anthony




Reply With Quote
  #3  
Old   
Bertil Isberg
 
Posts: n/a

Default Re: Query - insertTable - 08-09-2006 , 04:00 PM



this code works for me:

var
qvar query
endvar

qvar.readfromfile("z.qbe")

qVar.setCriteria("CUSTOMER.DB", "Customer No", "_Join1")
qVar.insertTable("ORDERS.DB", "CUSTOMER.DB")
qVar.setCriteria("ORDERS.DB", "Customer No", "_Join1")
qVar.executeQBE()

It would be a lot easier if you showed the code you have used.

--
Bertil Isberg - CTECH
Paradox buglist:
online: http://hem.bredband.net/bertilisberg/

"MA" <a@a.com> skrev i meddelandet news:44da4182 (AT) pnews (DOT) thedbcommunity.com...
Quote:
I forgot to indicate that I would really like to insert a table above the
first table in the given query.

Thank you,
Anthony

"MA" <a@a.com> escribió en el mensaje
news:44da40a9 (AT) pnews (DOT) thedbcommunity.com...
Does query.insertTable(TableToInsert, BeforeWhichTable) work at all ?

I have some saved queries and would like to :

query.readFromFile("queryFile.qbe")
query.insertTable( someTable, beforeThisTable)
query.setCriteria...

The syntax is:

insertTable ( const tableName String, const beforeTableName String )
SmallInt

and when I check the return value it is zero ( 0 ).

Thanks,
Anthony






Reply With Quote
  #4  
Old   
MA
 
Posts: n/a

Default Re: Query - insertTable - 08-10-2006 , 03:09 PM



OK, you're right, here's everything in more detail:

This is the original query that is saved on disk:

Query
ANSWER: C:\myDIR\PRIVATE\__ADA00_00T.DB

OPTIONS: NO AUXILIARY TABLES
:myALIAS:ADA00.db | NM_ADA00 | NM_AAA00 | Field1 | NM_AAB00 |
Quote:
Check | _Join1
Check | _Join2 |
:myALIAS:ADA00.db | Field2 | NM_Field3 | Field4 |
Quote:
Check | Check _Join3 | Check |
:myALIAS:AAA00.db | NM_AAA00 | Name |
Quote:
_Join1 | Check as "Company
A" |

:myALIAS:AAB00.db | NM_AAB00 | Name |
Quote:
_Join2 | Check as "Company
B" |

:myALIAS:ABA00.db | NM_ABA00 | Code | Passport |
Quote:
_Join3 | Check | Check |
:myALIAS:ABA00.db | Name | Surname |
Quote:
Check | Check |
EndQuery

.... and this is what I would like to achieve:

Query
ANSWER: D:\DBMS\PRIVATE\__ADA00_00T.DB

OPTIONS: NO AUXILIARY TABLES
:myALIAS:A0006.db | atDate | NM_Pointer |
Quote:
Today | _JoinX |
:myALIAS:ADA00.db | NM_ADA00 | NM_AAA00 | Field1 | NM_AAB00 |
Quote:
Check _JoinX | _Join1 |
Check | _Join2 |

:myALIAS:ADA00.db | Field2 | NM_Field3 | Field4 |
Quote:
Check | Check _Join3 | Check |
:myALIAS:AAA00.db | NM_AAA00 | Name |
Quote:
_Join1 | Check as "Company
A" |

:myALIAS:AAB00.db | NM_AAB00 | Name |
Quote:
_Join2 | Check as "Company
B" |

:myALIAS:ABA00.db | NM_ABA00 | Code | Passport |
Quote:
_Join3 | Check | Check |
:myALIAS:ABA00.db | Name | Surname |
Quote:
Check | Check |
EndQuery

....I tried your piece of code and it doesn´t work...

The code I was using was similar to yours only that
the "insertTable" was before all of the "setCriteria".

method pushButton(var eventInfo Event)
var
qvar query
st String
endvar

qvar.readfromfile("ADA00.qbe")

qVar.setCriteria("ADA00.DB", "NM_ADA00", "_JoinX")
qVar.insertTable("A0006.DB", "ADA00.DB")
qVar.setCriteria("A0006.DB", "NM_Pointer", "_JoinX")
qVar.setCriteria("A0006.DB", "atDate", "Today")

st = qvar.createQBEString()

st.view()

endMethod

When the dialog box for view() appears I can only see the original
query from disk except that it now has the join in place.

Thank you,
Anthony




Reply With Quote
  #5  
Old   
Bertil Isberg
 
Posts: n/a

Default Re: Query - insertTable - 08-10-2006 , 04:10 PM



Anthony

In your QBE file, the name of the table is
:myALIAS:A0006.db

Not A0006.db

and you want to add a table from .myalias: not from your working directory.



--
Bertil Isberg - CTECH
Paradox buglist:
online: http://hem.bredband.net/bertilisberg/

"MA" <a@a.com> skrev i meddelandet news:44db92a0 (AT) pnews (DOT) thedbcommunity.com...
Quote:
OK, you're right, here's everything in more detail:

This is the original query that is saved on disk:

Query
ANSWER: C:\myDIR\PRIVATE\__ADA00_00T.DB

OPTIONS: NO AUXILIARY TABLES
:myALIAS:ADA00.db | NM_ADA00 | NM_AAA00 | Field1 | NM_AAB00 |
| Check | _Join1 | Check
| _Join2 |

:myALIAS:ADA00.db | Field2 | NM_Field3 | Field4 |
| Check | Check _Join3 | Check |

:myALIAS:AAA00.db | NM_AAA00 | Name |
| _Join1 | Check as "Company
A" |

:myALIAS:AAB00.db | NM_AAB00 | Name |
| _Join2 | Check as "Company
B" |

:myALIAS:ABA00.db | NM_ABA00 | Code | Passport |
| _Join3 | Check | Check |

:myALIAS:ABA00.db | Name | Surname |
| Check | Check |

EndQuery

... and this is what I would like to achieve:

Query
ANSWER: D:\DBMS\PRIVATE\__ADA00_00T.DB

OPTIONS: NO AUXILIARY TABLES
:myALIAS:A0006.db | atDate | NM_Pointer |
| Today | _JoinX |

:myALIAS:ADA00.db | NM_ADA00 | NM_AAA00 | Field1 | NM_AAB00 |
| Check _JoinX | _Join1 |
Check | _Join2 |

:myALIAS:ADA00.db | Field2 | NM_Field3 | Field4 |
| Check | Check _Join3 | Check |

:myALIAS:AAA00.db | NM_AAA00 | Name |
| _Join1 | Check as "Company
A" |

:myALIAS:AAB00.db | NM_AAB00 | Name |
| _Join2 | Check as "Company
B" |

:myALIAS:ABA00.db | NM_ABA00 | Code | Passport |
| _Join3 | Check | Check |

:myALIAS:ABA00.db | Name | Surname |
| Check | Check |

EndQuery

...I tried your piece of code and it doesn´t work...

The code I was using was similar to yours only that
the "insertTable" was before all of the "setCriteria".

method pushButton(var eventInfo Event)
var
qvar query
st String
endvar

qvar.readfromfile("ADA00.qbe")

qVar.setCriteria("ADA00.DB", "NM_ADA00", "_JoinX")
qVar.insertTable("A0006.DB", "ADA00.DB")
qVar.setCriteria("A0006.DB", "NM_Pointer", "_JoinX")
qVar.setCriteria("A0006.DB", "atDate", "Today")

st = qvar.createQBEString()

st.view()

endMethod

When the dialog box for view() appears I can only see the original
query from disk except that it now has the join in place.

Thank you,
Anthony




Reply With Quote
  #6  
Old   
MA
 
Posts: n/a

Default Re: Query - insertTable - 08-10-2006 , 08:19 PM



Bertil,

:myAlias: IS the working dir & A0006.db IS in that dir

I think you misread something as the table A0006.db was mentioned in the
query that I would like to achieve by using insertTable and so add it above
the
first table of a query taken from disk (the one I exposed FIRST in my last
thread).

Thanks,
Anthony



Reply With Quote
  #7  
Old   
Bertil Isberg
 
Posts: n/a

Default Re: Query - insertTable - 08-11-2006 , 02:11 AM



Anthony

This is a part of your QBE

:myALIAS:ADA00.db | NM_ADA00 | NM_AAA00 | Field1 | NM_AAB00 |
Quote:
Check | _Join1
Check | _Join2

And this is your code

qVar.insertTable("A0006.DB", "ADA00.DB")



Can't you see the difference in your reference to ADA00.DB? There is no
table ADA00.DB in your QBE. The table is :myalias:ADA00.DB!!!



--
Bertil Isberg
CTECH
Paradox Buglist: http://hem.bredband.net/bertilisberg/

remove spamfilter (reversed) to reply


Reply With Quote
  #8  
Old   
MA
 
Posts: n/a

Default Re: Query - insertTable - 08-12-2006 , 12:05 PM



Bertil,

I forgot to mention that I had already tried:

qVar.insertTable("A0006.DB", ":myAlias:ADA00.DB")
& also
qVar.insertTable(":myAlias:A0006.DB", ":myAlias:ADA00.DB")

with no success.

Here's what I have done in the meantime (& it works):

var
qVar Query
st1,
st2,
stQuery String
si Smallint
endvar

qVar.readfromfile("ADA00.qbe")

st1= ":myALIAS:A0006.db | atDate | NM_Pointer | \r\n"
st2 = " | Today | _JoinX | \r\n\r\n"

qVar.readfromfile("ADA00.qbe")

qVar.setCriteria(":myALIAS:ADA00.DB", "NM_ADA00", "_JoinX")

stQuery = qVar.createQBEString()

;//this sets a pointer to where the header stuff ends
si = stQuery.search(":myALIAS:") - 1

;//now, do a concatenation & build the whole query as a string
stQuery = stQuery.subStr(1,si) + st1 + st2 + stQuery.subStr(si+1,
stQuery.size()-si)

;//convert the query string back to a Query Type
qVar.readFromString( stQuery )

;//execute it
qVar.executeQBE()

--------------------

Anthony




Reply With Quote
  #9  
Old   
Bertil Isberg
 
Posts: n/a

Default Re: Query - insertTable - 08-13-2006 , 04:38 AM



Anthony

<<
qVar.insertTable("A0006.DB", ":myAlias:ADA00.DB")
& also
qVar.insertTable(":myAlias:A0006.DB", ":myAlias:ADA00.DB")
Quote:
But did you also specify the alias in setCriteria()?

As I 've already mentioned, the code I showed did work for me. If you still
can't get it to run properly, I would recommend to get rid of the
underscores in the column names.





--
Bertil Isberg - CTECH
Paradox buglist:
online: http://hem.bredband.net/bertilisberg/

"MA" <a@a.com> skrev i meddelandet news:44de0afd (AT) pnews (DOT) thedbcommunity.com...
Quote:
Bertil,

I forgot to mention that I had already tried:

qVar.insertTable("A0006.DB", ":myAlias:ADA00.DB")
& also
qVar.insertTable(":myAlias:A0006.DB", ":myAlias:ADA00.DB")

with no success.

Here's what I have done in the meantime (& it works):

var
qVar Query
st1,
st2,
stQuery String
si Smallint
endvar

qVar.readfromfile("ADA00.qbe")

st1= ":myALIAS:A0006.db | atDate | NM_Pointer | \r\n"
st2 = " | Today | _JoinX |
\r\n\r\n"

qVar.readfromfile("ADA00.qbe")

qVar.setCriteria(":myALIAS:ADA00.DB", "NM_ADA00", "_JoinX")

stQuery = qVar.createQBEString()

;//this sets a pointer to where the header stuff ends
si = stQuery.search(":myALIAS:") - 1

;//now, do a concatenation & build the whole query as a string
stQuery = stQuery.subStr(1,si) + st1 + st2 + stQuery.subStr(si+1,
stQuery.size()-si)

;//convert the query string back to a Query Type
qVar.readFromString( stQuery )

;//execute it
qVar.executeQBE()

--------------------

Anthony






Reply With Quote
  #10  
Old   
MA
 
Posts: n/a

Default Re: Query - insertTable - 08-13-2006 , 08:33 AM



Bertil,

Yes, I did use the alias in the setCriteria as well.

When I do:
si = qVar.insertTable("A0006.DB", ":myAlias:ADA00.DB")
msgInfo("",si)
or

si = qVar.insertTable(":myAlias:A0006.DB", ":myAlias:ADA00.DB")
msgInfo("",si)

the value shown is always zero, which indicates that the table wasn't
inserted. Is it that insertTable only works under certain circumstances ?

Thank you,
Anthony




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.