NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: Richard I on March 17, 2024, 12:33:50 PM

Title: Using String Theory "StartsWith" in a report
Post by: Richard I on March 17, 2024, 12:33:50 PM
I have a report of Product names
Using st.StartsWith Im trying to exclude from the report those names starting with a value set in a local variable(loc:Value) on the report window
So the local variable is Office
and the Product Name Im wanting to exclude is OfficeSupplies
The Code I am using does not allow me to apply the search to PRO:Name
I have included in the Server Side code
            Set(Product)
            loop
            st.SetValue(p_web.GSV(' loc:value'))
            IF  st.StartsWith(p_web.GSV('loc:value')) = True THEN CYCLE END

How to please?
Thanks
Richard
NT14.19

Title: Re: Using String Theory "StartsWith" in a report
Post by: Rene Simons on March 17, 2024, 11:40:02 PM
Hi,

I think you should assign the value of PRO: name to the StringTheory object, like: st.setvalue(PRO:name)

Then do:
if st.startswith(loc:value) then cyle end , or

if st.startswith(p_web.gsv('loc:value')) then cycle end , (depending on the fact if  loc:value is a sessionqueue value or not).

I do not understand your loop construction but i guess you can figure that out. (All I see is a SET with no NEXT ).

I also have doubts on whether the server side code is the right place for your filter but as far as the "startswith" is concerned, I think that is the way to do it.

Kind regards,
Ren?



Title: Re: Using String Theory "StartsWith" in a report
Post by: Richard I on March 18, 2024, 12:19:05 AM
Thanks Rene,

Yes I didnt bother to include the detail of the LOOP , just wanted to impart the st, code used.
Thanks for replying
 Richard
Title: Re: Using String Theory "StartsWith" in a report
Post by: Bruce on March 18, 2024, 06:21:47 PM
st.SetValue(p_web.GSV(' loc:value'))
IF  st.StartsWith(p_web.GSV('loc:value'))

you're using loc:value on both sides of the IF statement here.
(also a type in the first GSV)