PB获取DW.DS的参数名、类型、参数的值

public function integer of_dwgetarguments (ref powerobject apo_aux, ref string as_argnames[], ref string as_argdatatypes[], ref string as_argvalues[]);
//====================================================================
// 事件: n_dwget_argument.of_dwgetarguments()
//--------------------------------------------------------------------
// 描述: 获取DW.DS的参数名、类型、参数的值
//--------------------------------------------------------------------
// 参数:
//  reference powerobject apo_aux           DW or DS
//  reference string      as_argnames[]     名称
//  reference string      as_argdatatypes[] 类型
//  reference string      as_argvalues[]    值
//--------------------------------------------------------------------
//====================================================================


string       ls_dwargs, ls_dwargswithtype[], ls_args[], ls_types[]
long         ll_a, ll_args, ll_pos, ll_index


// Comprobamos los argumentos.
if IsNull(apo_aux) or not IsValid(apo_aux) then
   return -1
end if


// Obtenemos el string con los argumentos del dw o ds.
ls_dwargs = apo_aux.DYNAMIC Describe ( "DataWindow.Table.Arguments" ) 


// Separamos los argumentos utilizando la un array y obtenemos el número total.
ll_args = of_ParseToArray ( ls_dwargs, "~n", ls_dwargswithtype ) 


// Ahora separamos el nombre del argumento de su tipo y además obtenemos el valor.


For ll_a = 1 to ll_args
   ll_pos = PosA ( ls_dwargswithtype[ll_a], "~t", 1 )


   If ll_pos > 0 Then
      ll_index = UpperBound(as_argnames) + 1
      as_argNames[ll_index]      = LeftA ( ls_dwargswithtype[ll_a], ll_pos - 1 ) 
      as_argDataTypes[ll_index] = MidA ( ls_dwargswithtype[ll_a], ll_pos + 1 ) 
      
      // Cargamos el valor correspondiente. Si es de tipo array ponemos cadena vacía.
      If rightA(as_argDataTypes[ll_index], 4) = 'list' Then
         as_argValues[ll_index] = ''
      Else
         as_argValues[ll_index] = apo_aux.DYNAMIC Describe("evaluate('" + as_argNames[UpperBound(as_argnames)] + "',1)") 
      End If
   End If 
 
Next
Return UpperBound ( as_argnames )
end function 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值