首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > PB >

怎么获得retrieve的参数

2012-06-11 
如何获得retrieve的参数一个数据窗口设置了retrieve的参数,是数值型,我想在打开这个数据窗口时,获取传过来

如何获得retrieve的参数
一个数据窗口设置了retrieve的参数,是数值型,我想在打开这个数据窗口时,获取传过来的这个值,请问怎么能取得,谢谢!!

[解决办法]
说的不清楚,你怎么传递的参数啊,定义相同类型的变量 ,接收啊
[解决办法]
用变量不是可以实现么?
[解决办法]
在sqlpreview事件中进行判断
当sqlpreviewtype = previewselect! 时,提取SQLSyntax, 然后跟dw_1.getssqlselect()的串进行比对
[解决办法]
建DW 对象的时候,试一下这样写SQL语句:
select :as_arg as col0, col1, col2, ....
from table 
where colx=:as_arg

这样,检索出有数据的时候,其中col0 列的数据就是传入的参数。

[解决办法]
方法二 到grid的SQL界面 选design-->retrieve argument 然后在下面写SQL就OK啦

探讨
建DW 对象的时候,试一下这样写SQL语句:
select :as_arg as col0, col1, col2, ....
from table
where colx=:as_arg

这样,检索出有数据的时候,其中col0 列的数据就是传入的参数。

[解决办法]
dw_1.describe("evaluate('parm1',1)")
[解决办法]
C# code
0000000000000000000000000
[解决办法]
[code=Delphi(Pascal)][/code][code=XML][/code][code=JScript][/code][code=Java][/code][code=JScript][/code][code=Delphi(Pascal)][/code]
[解决办法]
既然是用retrieve获取数据,那么你传过去的参数你不会知道吗?用个变量保存起来不就可以了
[解决办法]
探讨
建DW 对象的时候,试一下这样写SQL语句:
select :as_arg as col0, col1, col2, ....
from table
where colx=:as_arg

这样,检索出有数据的时候,其中col0 列的数据就是传入的参数。

[解决办法]
看看PFC是如何解决的:

//////////////////////////////////////////////////////////////////////////////
//Public Function: of_DWArguments (Format 1)
//Arguments:adwc_obj: DataWindow child to determine if there are arguments
//as_argnames[]: A string array (by reference) to hold the argument names
//as_argdatatypes[]: A string array (by reference) to hold argument datatypes
//Returns: Integer -The number of arguments found
//Description: Determines if a DataWindowChild has arguments and what they are.
//Note: This function has a (Format 2) which is very similar.
//////////////////////////////////////////////////////////////////////////////
//Rev. HistoryVersion
//5.0 Initial version
//5.0.01 Fixed bug so that reference arguments are populated correctly
//5.0.01 Function returns -1 if DataWindowChild reference is not valid
// 5.0.02 Added Stored Procedures support.
// 5.0.04 Fixed bug which prevented the looping around multiple arguments.
//8.0Switched to use new Describe String to get arguments
//9.0Fix CR305452
//////////////////////////////////////////////////////////////////////////////
//Copyright ?1996-2003 Sybase, Inc. and its subsidiaries. All rights reserved. Any distribution of the 
// PowerBuilder Foundation Classes (PFC) source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//////////////////////////////////////////////////////////////////////////////
string ls_dwargs, ls_dwargswithtype[], ls_args[], ls_types[]
long ll_a, ll_args, ll_pos
n_cst_string lnv_string

// Check arguments


if IsNull (adwc_obj) or not IsValid (adwc_obj) then
return -1
end if

ls_dwargs = adwc_obj.Describe ( "DataWindow.Table.Arguments" ) 

// Fix CR305452 to remove ~r
ll_args = lnv_string.of_ParseToArray ( ls_dwargs, "~n", ls_dwargswithtype ) 

For ll_a = 1 to ll_args
ll_pos = Pos ( ls_dwargswithtype[ll_a], "~t", 1 )
If ll_pos > 0 Then
as_argnames[UpperBound(as_argnames)+1] = Left ( ls_dwargswithtype[ll_a], ll_pos - 1 ) 
as_argdatatypes[UpperBound(as_argdatatypes)+1] = Mid ( ls_dwargswithtype[ll_a], ll_pos + 1 ) 
End If
Next

Return UpperBound ( as_argnames )
[解决办法]

探讨
建DW 对象的时候,试一下这样写SQL语句:
select :as_arg as col0, col1, col2, ....
from table
where colx=:as_arg

这样,检索出有数据的时候,其中col0 列的数据就是传入的参数。

热点排行