TEXT_PARAMETER can not be used ; PARAMETER_ATTR [message #660262] |
Mon, 13 February 2017 11:22 |
|
IneedYourHelp
Messages: 27 Registered: January 2017
|
Junior Member |
|
|
Hi,
I have table A in two Forms 1 and 2. When someone presses a button, I want to display the data he saw in table A in Forms 1, in table A in Forms 2 (I know it is not an realistic example having the same table twice..).
create table A (
X int primary key,
Y varchar(50),
Z varchar(50)
);
Form 1
When-Button-Pressed Trigger
DECLARE
pl_id ParamList;
pl_name varchar(9) := 'DATA';
begin
pl_id := get_parameter_list(pl_name);
if ID_NULL(pl_id) THEN
pl_id := create_parameter_list(pl_name);
else
destroy_parameter_list(pl_id);
pl_id := create_parameter_list(pl_name);
end if;
add_parameter(pl_name,'X_PARA',TEXT_PARAMETER,:A.X);
call_form('FORM2.fmx');
end;
Form 2
New-Form-Instance-Trigger
declare
X_OLD varchar(50);
begin
GET_PARAMETER_ATTR('DATA','X_PARA',TEXT_PARAMETER,X_OLD);
select X, Y, Z
into :A.X, :A.Y , :A.Z
from A where X_OLD=A.X;
end;
When I try to compile the New-Form-Instance-Trigger I get an error-message like:
TEXT_PARAMATER can not be used.
It refers to TEXT_PARAMETER in GET_PARAMETER_ATTR.
How can I solve this ?
Thanks in advance.
[EDITED by LF: fixed topic title typo]
[Updated on: Wed, 15 February 2017 15:10] by Moderator Report message to a moderator
|
|
|
Re: TEXT_PARAMATER can not be used ; PARAMETER_ATTR [message #660263 is a reply to message #660262] |
Mon, 13 February 2017 11:26 |
cookiemonster
Messages: 13961 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
You don't need to use get_parameter_attr at all. You need to create parameters with the correct name and type under the parameters node in object explorer. You can then refer to them same as datablock items:
select X, Y, Z
into :A.X, :A.Y , :A.Z
from A where :parameter.x_para = A.X;
You really should be using execute_query to populate the form, not a select.
|
|
|
|
|
|
|
|
|
Re: TEXT_PARAMATER can not be used ; PARAMETER_ATTR [message #660307 is a reply to message #660301] |
Tue, 14 February 2017 08:01 |
cookiemonster
Messages: 13961 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
By deleting the line of code that assigns a value to :a.x. It's not doing anything useful. It's not going to be used by the query, you would need to go into enter-query mode first, or do that assignment in pre-query instead.
I've already told you what you need, but I'll repeat:
Set the where clause property of the datablock, in it's property palette to:
x = :parameter.<name of parameter>
Then have WNFI issue execute_query.
That's all you need.
You don't need or want to copy the parameter to a datablock item.
|
|
|
|
|
|
|
|
|
|
|
|