PDA

View Full Version : Is this a bug


ABC123

Anis
03-27-2008, 12:41 PM
I have this script on a button That asks the user which account to filter, I set this up under aoperation-query records:

Account is equal to =var->AskC_Enter_an_Account

I run this on the active link table it always returns NO RECODS In Query
I run it on a passive link table (same database -same records) it returns all records .

I tested that on few different databases, always same result.
No records on activelink table, some records on passive link table.

Anis
03-27-2008, 07:01 PM
Did anyone try this ? any one experiencing the same issue ?

Selwyn Rabins
03-27-2008, 07:04 PM
I have this script on a button That asks the user which account to filter, I set this up under aoperation-query records:

Account is equal to =var->AskC_Enter_an_Account

I run this on the active link table it always returns NO RECODS In Query
I run it on a passive link table (same database -same records) it returns all records .

I tested that on few different databases, always same result.
No records on activelink table, some records on passive link table.

There is not enough information in your question to give an answer.

I need to know in more detail about what you are doing.

Anis
03-27-2008, 08:04 PM
Selwyn;


I have an activelink table and created a form to display the fields from that table. I wanted to add a button for the user to select and account, the script is created thru the Genie to create a query records operation.
It asks the user to enter the account number.

The same query is run against the passive link table of the same database, it returns records.
The only special thing I'm doing with the active link is thru the Select statement I'm grouping records by certain criteria, if that makes a difference.
Like total qty for that account.

In the screen shots attached, you see the account number actually displayed and exists, I just picked this one to show that it's there in the database, but no matter what account I used it returns no records.

NoeticCC
03-27-2008, 08:26 PM
Selwyn;


I have an activelink table and created a form to display the fields from that table. I wanted to add a button for the user to select and account, the script is created thru the Genie to create a query records operation.
It asks the user to enter the account number.

The same query is run against the passive link table of the same database, it returns records.
The only special thing I'm doing with the active link is thru the Select statement I'm grouping records by certain criteria, if that makes a difference.
Like total qty for that account.


May I ask why you are grouping results in an active link table? The main purpose of those os being able to update records, wheras grouped records are more for reporting than anything else.

There may well be a bug on this since the same query works with passive link tables, but it sounds to me like you just keep trying to use active link tables for purposes they just were not designed for.

Anis
03-27-2008, 08:45 PM
You could be right, but I'm using the active link table to group because I can't group the records in alpha5, the performance of this in A5 is very slow (I mean if I group an active link table records in A5) and I can't use passive link because I have to update the records all day.

The active link table is working fine with the grouping and refreshing and the data is coming in all day with speed and reflect on the form almost instantly.

Selwyn Rabins
03-27-2008, 10:05 PM
Selwyn;


I have an activelink table and created a form to display the fields from that table. I wanted to add a button for the user to select and account, the script is created thru the Genie to create a query records operation.
It asks the user to enter the account number.

The same query is run against the passive link table of the same database, it returns records.
The only special thing I'm doing with the active link is thru the Select statement I'm grouping records by certain criteria, if that makes a difference.
Like total qty for that account.

In the screen shots attached, you see the account number actually displayed and exists, I just picked this one to show that it's there in the database, but no matter what account I used it returns no records.


1. Please reply showing the xbasic code that is getting executed when you press the button. If the button's action was created using action scripting, you can open the action scripting editor, right click on an action and select 'show xbasic', then go to the all actions tab, and copy the xbasic.

2. Your embedded browse already has focus on the row showing the ID value. So, you don't really need to prompt for it again. You can simply read the value from the current row in the embedded browse.

Anis
03-27-2008, 10:45 PM
1-Button script:

query.filter = ""
query.order = ""

DIM operation_name as c
operation_name = "Account"
If operation_name <> "" then
query.run(operation_name,query.filter,query.order)
End if

operation script:
dim filter as c
dim order as c
dim options as c
dim description as c
dim show_all_flag as L
dim layout_name as c
dim layout_type as c
filter = "Pty_accnt = var->AskC_Enter_an_Account"
order = "recno()"
options = ""
description = "Saved Query: account"
show_all_flag = .f. 'user cannot turn off the query
layout_type = "browse" 'to open a form, set this to "form"
layout_name = "" 'This will open the default layout. You can also specify a named layout here
dim args as sql::arguments
if eval_valid("arguments") then
if typeof(arguments) = "P" then
args = arguments
end if
end if
a5_open_layout(layout_type,layout_name,"transactions",filter,order,description,options,show_all_flag,args)


2- I agree the reason I showed the same record just to show it exists, I added the browse just for me temporarily. I also have more than 3000 accounts it's not practical to go down searching for specific one and having a button to filter to that account is much simpler and faster.

Thanks

NoeticCC
03-28-2008, 06:19 AM
You could be right, but I'm using the active link table to group because I can't group the records in alpha5, the performance of this in A5 is very slow (I mean if I group an active link table records in A5) and I can't use passive link because I have to update the records all day.

The active link table is working fine with the grouping and refreshing and the data is coming in all day with speed and reflect on the form almost instantly.

I guess I am just not sure why you are running the queries on an active link table - surely a passive link table or even an SQL report would be more useful than active link tables which are designed for updating data and are constantly having to refresh etc. to keep the data current? I could imagine that for data entry an active link table that filters the results is more efficient than having to pull ALL entries out of the database just because you need those for reports?

Anis
04-04-2008, 12:51 PM
Selwyn;

Have you had a chance to look at this ? this is still a problem when you run the script, it finds no records if you run this query by asking the user for an account number and run it against the active link table.

Thanks

Selwyn Rabins
04-04-2008, 02:45 PM
1-Button script:

query.filter = ""
query.order = ""

DIM operation_name as c
operation_name = "Account"
If operation_name <> "" then
query.run(operation_name,query.filter,query.order)
End if

operation script:
dim filter as c
dim order as c
dim options as c
dim description as c
dim show_all_flag as L
dim layout_name as c
dim layout_type as c
filter = "Pty_accnt = var->AskC_Enter_an_Account"
order = "recno()"
options = ""
description = "Saved Query: account"
show_all_flag = .f. 'user cannot turn off the query
layout_type = "browse" 'to open a form, set this to "form"
layout_name = "" 'This will open the default layout. You can also specify a named layout here
dim args as sql::arguments
if eval_valid("arguments") then
if typeof(arguments) = "P" then
args = arguments
end if
end if
a5_open_layout(layout_type,layout_name,"transactions",filter,order,description,options,show_all_flag,args)


2- I agree the reason I showed the same record just to show it exists, I added the browse just for me temporarily. I also have more than 3000 accounts it's not practical to go down searching for specific one and having a button to filter to that account is much simpler and faster.

Thanks



(It is not clear to me if your active link table uses arguments in the SQL Select statement or not. I presume that it does not, becuase if it did, then you would get a second prompt for the argument value. That's because even though you are passing in arguments to the a5_open_layout() function, you are not setting any argument values).

The prompt that you are seeing is the prompt for the ask variable. I can duplicate that this is not working, and I am investigating it.
In the mean time if you change you script, you can get it to work:







dim filter as c
dim order as c
dim options as c
dim description as c
dim show_all_flag as L
dim layout_name as c
dim layout_type as c
dim acct as c
acct = ui_get_text("Account","Enter account number")
if acct = "" then
end
end if

filter = "Pty_accnt = " + s_quote(acct)
order = "recno()"
options = ""
description = "Saved Query: account"
show_all_flag = .f. 'user cannot turn off the query
layout_type = "browse" 'to open a form, set this to "form"
layout_name = ""

a5_open_layout(layout_type,layout_name,"transactions",filter,order,description,options,show_all_flag,args)


In other words, we are prompting for the parameter and then setting the filter to an explicit string before we call the a5_open_layout() function.

Anis
04-04-2008, 03:01 PM
Thanks Selwyn;

You are right it's not going against the SQL with an argument. I have another script that does and open a browse table for that. For this one I wanted that to be available on a form directly and goes against the A5 table and still use the same form displayed.
In your code that should open another instant of the form for the filtered account, which is fine.

Selwyn Rabins
04-04-2008, 04:46 PM
we have now fixed this

the bug was that if the filter in the a5_open_layout() command included ask variables, and the layout is based on an active link table, the command did not work.

this is now fixed. thanks for bringing this to out attention.

Anis
04-04-2008, 05:07 PM
Thanks Selwyn very much