NetTalk Central

Author Topic: Using String Theory "StartsWith" in a report  (Read 2529 times)

Richard I

  • Sr. Member
  • ****
  • Posts: 398
    • View Profile
    • Email
Using String Theory "StartsWith" in a report
« 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

« Last Edit: March 17, 2024, 12:59:15 PM by Richard I »

Rene Simons

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Re: Using String Theory "StartsWith" in a report
« Reply #1 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?



Rene Simons
NT14.14

Richard I

  • Sr. Member
  • ****
  • Posts: 398
    • View Profile
    • Email
Re: Using String Theory "StartsWith" in a report
« Reply #2 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

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Using String Theory "StartsWith" in a report
« Reply #3 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)