Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

function Get_Workcpace_ID ( "Workcpace Name" )

Status
Not open for further replies.

menu

Technical User
Apr 25, 2001
24
AE
Hello,

I’m trying to create a function called from WebLingo that take the Workspace Name as an input parameter and return the ID of that Workspace, I have succeeded in retrieving the ID but with additional text [A<1,?,'TotalNum'=17581>] while I want and I expect to see only 17581 (the IT Workspace ID).

1.Is there is something wrong with this function and why it is not reurning only one value i.e. 17581.
2.how can I get the 17581 out of A<1,?,'TotalNum'=17581> in WebLingo using the string function; in other words how I can always get the text between [=] and [>].



function Assoc GetNumberofObjectss( Object prgCtx, String objType )
Assoc retval
CAPICONNECT cnct
Dynamic recs
Integer totalRows
String errMsg

Boolean ok = TRUE
Object session = prgCtx

if !IsError( session )
cnct = session.fDbConnect.fConnection

recs = CAPI.Exec( cnct, Str.Format( 'select DataID from DTree where (ParentID = 2000) AND (Name=''' + objType + ''')' ) )

if Length( recs ) > 0
totalRows = recs[ 1 ][ 1 ]
else
totalRows = Length( recs )
end
else
totalRows = 100
end

if IsUndefined( retval.OK )
retval.TotalNum = totalRows
end

return retval
end

============Web Lingo===================

;String strProjectTitle = "IT Workspace" //Workspace Name
;Object uapiCtx = prgCtx.USession()
;String domainL
;domainL = Str.ValueToString( $Eforming.eUtils.GetWorkspaceID( uapiCtx , strProjectTitle ) )

<script language="JavaScript1.2">

alert("`domainL`");// return A&lt;1,?,'TotalNum'=17581&gt; while I want 17581

</script>
 
A means it is an assoc.You have to parse the assoc using oscript and then you can do what you want.Assoc manipulation methods are explained in the documentation itself.I do not remember it off hand.But I belive there should be something like GetItems
A hint of advice weblingo is already output returned by livelink and hence it may not be a good place to do a lot of logic etc.It is the "presentation layer" if you will.You will get unexpected results if the program context differs from person to person.

Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top