Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

useing objpal to change field order

Status
Not open for further replies.

kjjj

Technical User
Apr 23, 2005
19
US
setAnswerFieldOrder
I solved my last problem with tony and woodys help thanx, (they solved it) I have searched the web and the other paradox BB's looking for another way than restructure, drag and paste to change the field order of a table.
I have been trying to use "setAnswerFieldOrder"
In the P10 OBJpal Reference, the code is as follows
var
qVar Query
arFields Array[] String
endVar
qVar.readFromFile( "myquery.qbe" )
qVar.getAnswerFieldOrder( arFields )
if arFields.size() > 0 then ; swap the first and third fields
; in the answer table.
arFields.exchange(1,3)
qVar.setAnswerFieldOrder( arFields )
qVar.executeQBE()
endif

I added an extra line:
if not qVar.executeQBE() then errorShow()
endIf

the error say "string is empty" and I'm not sure why because line "qVar.getAnswerFieldOrder( arFields )"
should populate the string. (?)

Bertl's site says @
"In P10, a query with an alias specified will cause a IPF on setAnswerFieldOrder()."
I'm not useing an alias and it seems to difficult to move a few fields around so I must be doing things the hard way? I suspect it's not "setAnswerFieldOrder" problem but the help file is wrong?
PS I have taken the keys off and PDOX 10.0.663 build
Thanks for any help
kim
kjjj
 
Where did the original .qbe file come from?
What are you trying to accomplish, exactly?


getAnswerFieldOrder() works "when a custom field order has been specified". "If a custom field order is not specified for the query, this method returns an empty array."

Which means the .qbe file you are reading must already have a field order specified in it. Does it have a field order specified?

However, even with a field sort order specified I get a GPF every time I try to retrieve the sort order.

Again, then, what exactly are you starting with and what is your goal?

Tony McGuire
"It's not about having enough time. It's about priorities.
 
Tony Thanks for Your reply as you can tell I don't program for a living thank God I. (I do enjoy the challenge and am working on something for my future...and only for my own use)
what I was trying to do was change the field order plain and simple but not through a restructure or by dragging a field in the table. I am useing a create to create a chart, even though I've tried to spell it out in the create method which fields it needs for the x and y axis (3rd and 5th fields) it seemes to want the prior fields along with it screwing up the chart, yet if I manually restructure and move the 2 fields to the first and second(second being thye y axis) the table then it draws the chart correctly.

So thats what I was trying to accomplish, my means, the original .qbe was a blank qbe (check marked only) I thought the set and getAnswerFieldOrder would do that and maybe it does ... I don't understand and I WOULD LIKE TO KNOW what I was doing that was wrong. It finally came back to me to just use a sql statement and assign the order. Much easyer.

In the help example it mention exchangeing field 1 for field 3, I suspect I needed to query for something specific hence the error "query string is empty"?

I guess I just need to stick to what I forgot. I truely do along with others appretiate your patience and your time. If you don't have the time to explain that's ok.

I read and use the "objectPAL resource" and have M.Prestwood's Power Programming however I also have AAD:(
read read and reread, thanks for your help.
kim
kjjj
 
Are you aware that if you use a query image in code, the 'answer' table's fields will be in the order of your query image?

Code:
qbe=query

sometable.db | fieldOne | fieldTwo |
             | check    | check    |

endquery

will give an answer.db with fieldOne as the first field and fieldTwo as the second field.

Code:
qbe=query

sometable.db | fieldTwo | fieldOne |
             | check    | check    |

endquery

on the other hand, will result in a table with fieldTwo as the first field and fieldOne as the second field.

Not sure you can make use of this, but thought I should mention in case you weren't aware of this.

Tony McGuire
"It's not about having enough time. It's about priorities.
 
Tony yes I can use it at some point, infact I even do thing I shouldn't do at times... untill I learn better ways.

I found using SQL did what I wanted... But on the fly I now have another tool. (THANKS)I'm laughing because even I know that this is so basic but I'm learning. On another note yesterday I made great strides in programming my mouse(doubleclick) to change a chart... because of where on the chart I click it now goes back to the table and gets extra info and or changes it. For Me that was huge!!! Thanks for all your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top