Combine request results

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by  Denny Wong 1 week, 1 day ago.

  • Author
    Posts
  • #4202

    David Cook
    Participant

    Hi

    I have a zone stamp that has the following line in the Master Script which returns the ID of the zone. Works great.
    x = REQUEST("ID_of_main", "", IDText)

    We’ve got a project where we want to hot link in a module several times and add the prefix. Now I can get the prefix to show up, but not the ID if I change this line to
    x = REQUEST("Full_ID_of_parent", "", IDText)

    Is there any way I can do a double request
    x = REQUEST("Full_ID_of_parent" & "ID_of_main", "", IDText)

    or filter the results into a secondary line of code to get the IDText variable to display them as a combined result?

    x = REQUEST("ID_of_main", "", IDTexta)
    x = REQUEST("Full_ID_of_parent", "", IDTextb)
    IDText = IDTextA & IDTextB

    Appreciate any assistance/advice/ that can be provided. I’m still relatively new with this side of the GDL commands.

    Regards

    Dave Cook

  • #4224

    Denny Wong
    Participant

    Hi David,

    Not sure if I got your question correctly – this sounds more to do with string concatenation rather than the REQUEST itself. & operator in GDL is a Boolean operator; + is the operator you are looking for:

    n1 = REQUEST("ID_of_main", "", IDTextA)
    n2 = REQUEST("Full_ID_of_parent", "", IDTextB)
    if n1 and n2 then
      IDText = IDTextB + IDTextA
    else
      print "Something went wrong"
    endif

    I am not sure if REQUEST will give an Integer if IDTextA turns out to be all numbers, in which case you might need to do a VARTYPE then str(“%.0”, IDTextA) before concatenating.

    I also want to point out that if you put these REQUESTS in the Master Script, they will produce a numerical “0” if GLOB_SCRIPT_TYPE is Parameter Script. If you then try to + two 0s together obviously you will get a 0. If your confusion comes from seeing 0s as your script result, may be that’s the reason.

    kind regards,

    Denny

    Bond Bryan Architects, Westerham, UK

You must be logged in to reply to this topic.