Mehram
asked on
To know retrieval argument names and its type of non-updatable datawindows.
PB7 or
PB 10.5
If I know this, I will save 25% development time.
Lets say the variable "dw_xyz" holds a datawindow name "report_dw_abc".
Through powerbuilder script, I want to know all the retrieval arguments names and types of "repor_dw_abc".
PB 10.5
If I know this, I will save 25% development time.
Lets say the variable "dw_xyz" holds a datawindow name "report_dw_abc".
Through powerbuilder script, I want to know all the retrieval arguments names and types of "repor_dw_abc".
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi,
Please find another logic, please refine it if u can think of something better, just a quick response,
string ls_args, ls_arg[]
Long i = 0, ll_POS
ls_args = dw_1.object.datawindow.tab le.argumen ts
Do While Len(ls_args) > 0
i++
If Mod(i,2) > 0 Then
ll_POS = Pos(ls_args,'~t')
Else
ll_POS = Pos(ls_args,'~n')
End If
If ll_POS > 0 Then ll_POS --
If ll_POS = 0 Then ll_POS = Len(ls_args)
ls_arg[i] = Mid(ls_args,1,ll_POS)
ls_args = Mid(ls_args,ll_POS + 1)
Loop
For i = 1 to UpperBound(ls_arg[])
ll_POS = Pos(ls_arg[i],'~t')
If ll_POS = 0 Then
ll_POS = Pos(ls_arg[i],'~n')
End If
ls_arg[i] = Mid(ls_arg[i],ll_POS+1)
Next
Im sure u wont get tab or space in the above code.
Cheers,
Rosh
Please find another logic, please refine it if u can think of something better, just a quick response,
string ls_args, ls_arg[]
Long i = 0, ll_POS
ls_args = dw_1.object.datawindow.tab
Do While Len(ls_args) > 0
i++
If Mod(i,2) > 0 Then
ll_POS = Pos(ls_args,'~t')
Else
ll_POS = Pos(ls_args,'~n')
End If
If ll_POS > 0 Then ll_POS --
If ll_POS = 0 Then ll_POS = Len(ls_args)
ls_arg[i] = Mid(ls_args,1,ll_POS)
ls_args = Mid(ls_args,ll_POS + 1)
Loop
For i = 1 to UpperBound(ls_arg[])
ll_POS = Pos(ls_arg[i],'~t')
If ll_POS = 0 Then
ll_POS = Pos(ls_arg[i],'~n')
End If
ls_arg[i] = Mid(ls_arg[i],ll_POS+1)
Next
Im sure u wont get tab or space in the above code.
Cheers,
Rosh
ASKER
Hi Rosh
I understand
another loop to find tab and newrow and eliminate it from the array.
Thanks
Mateen
I understand
another loop to find tab and newrow and eliminate it from the array.
Thanks
Mateen
ASKER
Hi rosh
<<please refine it if u can think of something better, just a quick response>>
this code is working
<<please refine it if u can think of something better, just a quick response>>
this code is working
string ls_args, ls_arg[]
Long i = 0, ll_POS, ll_pos2
ls_args = dw_1.object.datawindow.table.arguments
Do While Len(ls_args) > 0
i++
If Mod(i,2) > 0 Then
ll_POS = Pos(ls_args,'~t')
Else
ll_POS = Pos(ls_args,'~n')
End If
If ll_POS = 0 Then ll_POS = Len(ls_args)
ls_arg[i] = Mid(ls_args,1,ll_POS)
ls_args = Mid(ls_args,ll_POS + 1)
// Lines added
ll_pos2 = pos(ls_arg[i],'~t')
if ll_pos2 > 0 then
ls_arg[i] = mid(ls_arg[i],1,ll_pos2 - 1)
end if
ll_pos2 = pos(ls_arg[i],'~n')
if ll_pos2 > 0 then
ls_arg[i] = mid(ls_arg[i],1,ll_pos2 - 1)
end if
Loop
ASKER
Its a great jump towards automation.
a_stparm = message.PowerObjectParm
a_stparm.s_filed_req = 0
a_stParm.i_filed_req = 0
a_stParm.d_filed_req = 0
a_stParm.dt_filed_req = 0
long ijk
for ijk = 1 to 12
a_stparm.ddw_req[ijk]='N'
end for
dw_1.dataobject = a_stparm.szdatawindow
string ls_args, ls_arg[]
Long i = 0, ll_POS
ls_args = dw_1.object.datawindow.tab
messagebox('',ls_args)
Do While Len(ls_args) > 0
i++
If Mod(i,2) > 0 Then
ll_POS = Pos(ls_args,'~t')
Else
ll_POS = Pos(ls_args,'~n')
End If
If ll_POS = 0 Then ll_POS = Len(ls_args)
ls_arg[i] = trim(Mid(ls_args,1,ll_POS)
ls_args = Mid(ls_args,ll_POS + 1)
Loop
for ijk = 2 to upperbound(ls_arg[]) step 2
if left(ls_arg[ijk],6) = 'string' then
a_stparm.s_filed_req++
end if
if left(ls_arg[ijk],4) = 'date' then
a_stparm.d_filed_req++
end if
if left(ls_arg[ijk],8) = 'datetime' then
a_stparm.dt_filed_req++
end if
if left(ls_arg[ijk],6) = 'number' then
a_stparm.i_filed_req++
end if
end for
dw_1.dataobject = "d_extrnal"
>> if left(ls_arg[ijk],4) = 'date' then
Why am I using left function?
I am unable to remove tab or space from "string " or "date " etc. The trim command is not working, I don't know why.