tnzabo
27th February 2006, 21:34
Hello,

I've created a new session based on the table tdpur046. It is my main table and the key used when the find button is pushed is the supplier number. tdpur046.suno. Now, First I'm not sure what that field is called where we enter the search field info. I'm assuming it is the key field tdpur046.suno. However, when I debug and go to look at that field sometimes it's the value I entered and sometimes it's not. Can anyone tell me what the variable for the "find" field(s) is/are?

Second, I'm using a query.extension on my main.table.io section on tdpur046. I don't want to return all the records so I'm doing this to save some time. However, when I take the query extension off, it seems that the value in the tdpur046.suno field is always what I type in the "find" field. Would anyone know about this Baan functionality and be able to help me out?

Thanks,
tnzabo

mark_h
27th February 2006, 22:49
Check this thread (http://www.baanboard.com/baanboard/showthread.php?t=10017&highlight=rebuild.query) out. It shows an example of how to change the query.extend.

The field where you enter the search criteria should be the main table fields on the session. So if your main table is tdpur046 and you click on binoculars, then the field it would input is tdpur046.suno. There are really two events for find - def.find(promptf or data) and find.data(find the data).

tnzabo
27th February 2006, 23:06
So, I debug my session and look at tdpur046.suno field value and sometimes it's what I've entered for the find and sometimes it's not. Why is this and does it have something to do with my query.extension? my query.extension is very simple - query.exension="tdpur046.stsp = 1"

I know the suno I'm entering to find fits this stsp = 1 criteria.

tnzabo

mark_h
27th February 2006, 23:32
What are your key fields on the session? What clicking on binoculars asks you to enter. Where are you checking the value of the suno field? Probably the after choice of def.find is the best place. Remember that in the find.data sometimes it may not return the correct record(because of what was entered in the find).

Also since you are not changing the query.extension it does not need to be rebuilt. It maybe best if you post your code here - might help someone see what I am missing or what is wrong.

tnzabo
27th February 2006, 23:48
There is only 1 key and it is suno. That is all that is asked for when the binoculars are clicked. I check the tdpur046.suno when it goes back to the debug window after okay is clicked. Sometimes it has the value I entered in it and sometimes it doesn't. I'm pretty sure it has to do with my extension because if I comment it out then my entered value is always in that field. I need to have that query extension though or it slows my program down terribly. As I said before I don't understand why it is acting this way because the supplier I am keying in I know fits this tdpur046.stsp =1 criteria so it should find it. I've pasted the query.extension code. I'm not sure what else you would want to see.

|****************************** PROGRAM SECTION ***************************
before.program:

query.extension = "tdpur046.stsp = 1"

mark_h
28th February 2006, 00:22
With this query.extension can you find the record in question by just using the next/prev record buttons? The whole script may help someone see what is causing the problem.

bdittmar
28th February 2006, 13:09
So, I debug my session and look at tdpur046.suno field value and sometimes it's what I've entered for the find and sometimes it's not. Why is this and does it have something to do with my query.extension? my query.extension is very simple - query.exension="tdpur046.stsp = 1"

I know the suno I'm entering to find fits this stsp = 1 criteria.

tnzabo

Hello,

Index 1 in table tdpur046 is :
suno, orno, pono, srnb, srni
Field tdpur046.stsp is not in index.



Regards

mark_h
28th February 2006, 15:46
I generated a session on this table. Used the same query.extension and it worked. I then put a message statement in the after.choice of the event choice.def.find. It always returned what I entered as long as I entered a supplier that had stsp = 1, but I always cleared out the order number. If I did not clear out the order number then it returned the first suppler larger that the one I entered. If you entered a supplier that did not have tdpur046.stsp = 1 it would again pick the first supplier larger that the one I entered. If your form is only using supplier try using the other index fields on the form. I think it is the fact that purchase order is missing.

Kingsto88
1st March 2006, 11:43
Hi,

In line with this thread, I actually want to find data for a field which is not in any of the main table index. Eg. Refb in table tdpur400. How do i do this?

If I cannot use the find.data because the field must be in the index, then what other way to do this.

I have created a new session, for user to enter what he wants to find,eg.refb="YYY". Then i was hoping to pass back that value and search the parent session for the record with refb equal to "YYY" value. If it finds the record with refb="YYY", then i was hoping the multi occurence record will jump to that record.

How can I do this without the parent session program script. Can I? Can I use refresh, or refresh.parent(), or refresh.all.occ(), or make.current()??

Thanks and regards,

mark_h
1st March 2006, 15:42
Lets see if I understand correctly you have a parent session and a sub-session to enter refb values - correct? So lets say in the parent session you set the query.extension to tdpur400.refb<> "" in the before program. Then the user does something(clicks a button) and goes to the sub-session, enters a refb value, clicks okay and returns to parent session. In the parent session you can then reset the query.extension and use the rebuild.query command. See the link in my previous post on that.

I also think Nikki's problem is because of the purchase order number. I took all key index fields off my test form but supplier number. It acted just like what was described. As a matter of fact only on certain suppliers did it work.

Kingsto88
2nd March 2006, 09:55
Hi Mark,

Let me explain it in a better way. I have this problem because I do not want to modify the main table index. So I wish to create a session similar to the Find dialog box without creating a new index for the table. I believe Find button can only look for fields which are index keys.

1) Parent session = session A-multi occ.
(std program with no program script available)
Index is by field f1,f2,f3

2) I created a session B. This session just prompts for a string.

3) I call session B from session A by clicking on Special/Specific

4) When session B appears, users key in the string, which is actually a value which user wants to find in one field of the main table of Session A

5) As session B closes, it returns to session A. But I wish the cursor to jump to the record that has the field with the string value entered in session B.

Hope this explains it better.

thanks n regards,

mark_h
2nd March 2006, 16:39
Sounds like all you need do is something like this in session a:

choice.user.1:
on.choice:
export("somevar",somevar)
wait.and.activate("session b")
import("somevar",somevar)
select maintable
from maintable
where maintable.somefield = :somevar
as set with 1 rows
selectdo
endselect
execute(find.data)

The select sets all the key fields for whatever the maintable is. Then the execute(find.data) finds that specific record and pulls it up. Just remember that your "somevar" needs to be unique or this just finds the first record. Or if you know other fields then just include them in the query to narrow your search.

tnzabo
2nd March 2006, 16:39
Hello! So, here's what I ended up having to do to get this to work. I had to allow the purchase order number and the line number from tdpur046 to be available on my def.find box. I then can enter the supplier number and clear out the other two values or, if I know them I can enter them and I get the correct answer!

Thank You Mark, once again, you are the man!!

Kingsto88
3rd March 2006, 04:54
Hi Mark,

I think it will not work for my case.

You see I mentioned I do not have the script for std session A.

I am creating a new session B.

In session B, I can import(var),
do the select statement and export(var) back to A.

But if i run execute(find.data) in program script B, will it reach the session A and find the data I want. I don't think so.

Is that right? Do you think it will work?

Thanks and regards,

mark_h
3rd March 2006, 15:08
No - what I suggested would not work with session A. I take it you do not have a wrapper program (Q-key, RMCis) product - or maybe you can use ~Vamsi's solution. Not sure how you could do this without session A's code.