Virender
5th January 2012, 14:42
Hi, I have a session which is been zoomed from another session from a field.
I need whenever the session is zoomed it should show only a particular record.
I am using following script on, it is not giving any error but not showing selected record, in debug I could found the variables are having correct value, please suggest...
----
zoom.from.all:
on.entry:
get.var(parent, "whinh220.orno", morno)
get.var(parent, "whinh220.pono", mlin)
query.extend.where.in.zoom("whalp212.ordn = " & quoted.string(morno) & " and whalp212.line = " & quoted.string(mlin))
JaapJD
5th January 2012, 15:16
The query.extend.where.in.zoom function should be used in the calling session. If you want to code it in the called session, you should use query.extend.where.
Virender
5th January 2012, 17:40
Hi Jaap
Tried as suggested but it is still not opening the corrected record.
JaapJD
5th January 2012, 17:45
If you changed the called session to use query.extend.where, you need also to call the rebuild.query() function. And maybe you need also the execute(find.data).
ipineda
5th January 2012, 18:01
Hi friend,
First thing you have to use query.extend.where.in.zoom() in the selection.filter sub-section of the field you are working. Another important thing is that the field whinh220.pono is numeric and you are using quoted.string(), that is not right.
Good luck.
Virender
5th January 2012, 21:12
Hi,
Thanks for the posts friends.
Jaap, Achually I am making a change in the form, I have changed a normal input field to a input zoom field which if zoomed opens the session where user has to enter some input in a field for a selected record as per parent session.
I do not have the script of main session.
The sub session is a customized session so I can write a script on it.
As suggested I will try for rebuild.query.
Ipineda, As I explained above I can not write anything on the main form field as do not have script of the same. I have also tried it without quoted string but still not working.
Thanks
Virendra
dhruv_x0
6th January 2012, 09:03
Hi,
You can also try Query.extension = "Expression " in before .program section of the cutomized session.
When this customized session is opened, import order and position in variables in before.program section and then you can use query.extension.
For ex.
before.program:
import("whinh220.orno",var.orno)
import("whinh220.pono",var.pono)
query.extension = "customized table._index1 inrange {:var.orno,:var.pono}"
or
query.extension = "customized table.orno = :var.orno and customized table.pono = :var.pono"
Might Help.
Regards Dhruv
v_kewl
6th January 2012, 10:37
I feels following code posted by you is wrong:
query.extend.where.in.zoom("whalp212.ordn = " & quoted.string(morno) & " and whalp212.line = " & quoted.string(mlin))
Instead of quaoted.string for a long value "mlin" use str$(mlin). i.e.,
query.extend.where.in.zoom("whalp212.ordn = " & quoted.string(morno) & " and whalp212.line = " & str$(mlin))
Also if require use rebuild.query() after writingthe above code.
Regards,
Gaurav
v_kewl
6th January 2012, 10:40
And also if require try after this rebuild.query()
ipineda
6th January 2012, 18:33
In that case, try the rebuild.query() I'm sure that will help, and post your solution so other can get help too.
Bye.
Virender
21st January 2012, 14:01
Hi friends...
Sorry for not responding on the posts, was away on another task.
Started working again on it, unfortunately I am still stuck on it.
Here is the outcome.
I changed the query to as suggested:
before.program:
get.var(parent, "whinh220.orno", morno)
get.var(parent, "whinh220.pono", mlin)
get.var(parent, "whinh220.oorg", motyp)
query.extension = "whalp212.ordn = morno and whalp212.line = mlin"
rebuild.query()
------
it gives error.
Following is windows error log which shows SQL syntax not correct, we can see values are passed fine now but the syntax seems to be wrong.
BdbErrno : 302 (SQL syntax not correct)
ExtraInfo : session: "whalp2112m001";object: "whalp2112m001"; function: "sql.parse.stp" sql.parse; company number: 450
query: "SELECT whalp212.* FROM whalp212 WHERE {whalp212.otyp,whalp212.ordn,whalp212.line} = {:whalp212.otyp,:whalp212.ordn,:whalp212.line} AND (whalp212.ordn = 100000044 and whalp212.line = 10) ORDER BY whalp212._index1 "
Message : FATAL ERROR: Error 302 (SQL syntax not correct) on sql statement
Any suggestions...
Thanks
Virender
Virender
29th January 2012, 15:51
:)
Finally its done, here is the final code.
before.program:
get.var(parent, "whinh200.oorg", motyp)
get.var(parent, "whinh200.orno", morno)
form.all:
before.form:
query.extend.select("whalp212.* ")
query.extend.from("whalp212")
query.extend.where("whalp212.otyp = " & str$(etol(motyp)) & " and whalp212.ordn = " & quoted.string(morno))
rebuild.query()
execute(find.data)
Thanks all for all your valuable comments.
Virender
Virender
29th January 2012, 15:53
Closing the thread...
mark_h
30th January 2012, 15:35
No reason to close it or lock. Someone else might have a question on this topic and continue this thread.
Thanks
Virender
1st February 2012, 08:09
No reason to close it or lock. Someone else might have a question on this topic and continue this thread.
Thanks
You are right Mark, sure.
Thanks