project BLF > class BStoredSearch > method GetStoredSearchView

Description

Method to get Stored Search View information


Parameters


ovBStoredSearchoutputdataset
tStoredSearchViewoutputtemp-table
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program1/bstoredsearch.p)

if oiReturnStatus = 0 
then assign oiReturnStatus = -98.

empty temp-table tStoredSearchView.

<Q-2 run UserPrim
   (Start) in BUser >
<Q-5 run RolePrim
   (Start) in BRole >
for each tStoredSearch:
    create tStoredSearchView.
    buffer-copy tStoredSearch to tStoredSearchView.

    /*fill extra fields*/

    if tStoredSearch.Usr_ID <> 0 and tStoredSearch.Usr_ID <> ?
    then do:
        <Q-1 run UserPrim (all) (Read) (NoCache)
           (input tStoredSearch.Usr_ID, (UsrId)
            input ?, (UsrLogin)
            output dataset tqUserPrim) in BUser >
        find first tqUserPrim no-error.
        if available tqUserPrim
        then assign tStoredSearchView.tcUsrLogin = tqUserPrim.tcUsrLogin.
    end.

    if tStoredSearch.Role_ID <> 0 and tStoredSearch.Role_ID <> ?
    then do:
        <Q-4 run RolePrim (all) (Read) (NoCache)
           (input tStoredSearch.Role_ID, (RoleID)
            input ?, (RoleName)
            output dataset tqRolePrim) in BRole >
        find first tqRolePrim no-error.
        if available tqRolePrim
        then assign tStoredSearchView.tcRoleName = tqRolePrim.tcRoleName.
    end.

    if num-entries(tStoredSearch.StoredSearchLookupRef,"/":U) = 1 and
       num-entries(tStoredSearch.StoredSearchLookupRef,".":U) = 2
    then assign tStoredSearchView.tcComponentName = entry(1,tStoredSearch.StoredSearchLookupRef,".":U).
    else
    if num-entries(tStoredSearch.StoredSearchLookupRef,"/":U) = 2 and
       num-entries(entry(2,tStoredSearch.StoredSearchLookupRef,"/":U),".":U) = 2
    then assign tStoredSearchView.tcComponentName = entry(1,entry(2,tStoredSearch.StoredSearchLookupRef,"/":U),".":U).
    else assign tStoredSearchView.tcComponentName = trim(#T-7'Unknown':20(425)T-7#).

    if tStoredSearch.Usr_ID <> 0 and tStoredSearch.Usr_ID <> ?
    then assign tStoredSearchView.tcStoredSearchLevel = Trim(#T-8'User':20(4751)T-8#).   
    else if tStoredSearch.Role_ID <> 0 and tStoredSearch.Role_ID <> ?
    then assign tStoredSearchView.tcStoredSearchLevel = Trim(#T-9'Role':20(1)T-9#).
    else assign tStoredSearchView.tcStoredSearchLevel = Trim(#T-10'System':20(4750)T-10#).
end. /*or each tStoredSearch:*/
<Q-3 run UserPrim
   (Stop) in BUser >
<Q-6 run RolePrim
   (Stop) in BRole >

if oiReturnStatus = -98
then assign oiReturnStatus = 0.