Request Object Parameters with Label

Home Forums Problems and solutions in GDL Documentation elements, text handling Request Object Parameters with Label

This topic contains 4 replies, has 3 voices, and was last updated by  Scott Graham 1 week, 5 days ago.

  • Author
    Posts
  • #4769

    Scott Graham
    Participant

    I am working on a custom label that I would like to read the values of certain parameters from the labeled object, and can’t seem to find the right script command. This would be an associative label only for now. Maybe I’ll add custom options for independent labels later.

    How I want it to work:

    1. This is limited just to Objects, but applies to non-global variables.
    2. In the Label’s settings, I would specify a list of parameter names I want it to retrieve from the labeled object (separated by a comma perhaps that could be broken up with a split command later).
    Let’s keep it simple and say I just want it to retrieve the value of “parameter 1” from the labeled object.
    3. I would then be able to use this value in the script of my label to adjust other functions for the label’s appearance based on the parameter values retrieved from the associated object.

    REQUEST only seems to work for global parameters/properties
    Can the CALL function be used to get those parameter values if there’s no specific library name to CALL?

    Help is most appreciated!

  • #4770

    Joachim Sühlo
    Participant

    Have you tried this (this REQUEST works in labels and markers to read Parameters from the associated objects):
    REQUEST (“ASSOCLP_PARVALUE”, expr, name_or_index, type, flags, dim1, dim2, p_values)

    Example from a GS-Marker:
    ! — Fire Rating ————————————————————–

    if GS_iCustomText_5 = CTXT_MEASUREDVALUE or not(AC_show_firerating) then
    firerating = “”
    rrr = request (“ASSOCLP_PARVALUE”, “gs_list_firerating”,
    index_firerating, type_firerating, flags_firerating,
    dim1_firerating, dim2_firerating, firerating)
    AC_MarkerText_5 = AC_FirePrefix + firerating ! Fire Rating Value
    parameters AC_MarkerText_5 = AC_MarkerText_5
    endif

    GDL Object Developer
    b-prisma
    MAC OSx 10.12

  • #4773

    Scott Graham
    Participant

    Thank you Joachim,

    So if I’m trying to retrieve the value of a parameter “bDoor” (boolean value), I would do the following?

    bDoor=”” !!! (does the empty expression initialize a variable regardless of what type it is?)

    rrr=request(ASSOCLP_PARVALUE”,”bDoor”, index_bDoor, type_bDoor, flags_bDoor, dim1_bDoor, dim2_bDoor, bDoor) !!! (are the index_, type_, flags_, dim1_, and dim2_ necessary here if I know the nature of the variable I’m looking for?)

    parameters bDoor=bDoor

  • #4778

    Péter Baksa
    Participant

    Hi,

    bDoor = “” initializes the variable as a string, bDoor = 0 as numeric. It could cause a problem if the request fails, and you compare an integer against the string variable.

    All the variables are needed in the request expression, altough you can use shorter names for the unneeded ones.

    The last parameters expression is not needed, your bDoor is a variable.

    Péter Baksa
    Software Engineer, Library Team
    GRAPHISOFT SE

  • #4780

    Scott Graham
    Participant

    Finally got it to work!
    Thank you both for your help!

You must be logged in to reply to this topic.