Assign a Query result to a variable, from an Array query with variable concat

  • Hi,

    I can´t resolve this; ataching a variable to the array query and assigning to an other variable.(second line)

    Code
    set(lotenum, get(hotspot[get(i)].lote));
    set(lotedisponible, get(datoslotifica[get(lotenum)].status));
    
    if(lotedisponible == 1,
    			set(hotspot[get(lotenum].fillcolor, colorlote_disponible);, 
    			lotedisponible == 2,
    				set(hotspot[get(lotenum].fillcolor, colorlote_apartado);, 
    				set(hotspot[get(lotenum].fillcolor, colorlote_vendido);
    );

    The first variable lotenum works fine, but when I try to asign the array result to lotedisponible it didn´t returns nothing

    I want to assign color to some polyhotspots

    Please Help

  • alexgtz October 7, 2024 at 8:48 PM

    Changed the title of the thread from “Assign a Query result to a variable, from an Array with variable concat” to “Assign a Query result to a variable, from an Array query with variable concat”.
  • Try using get() to set the actual value:

    Code
    set(var, get(var));

    Thanks but it depends on the result of the array, where I have the var

    Code
    get(datoslotifica[get(lotenum)].status)

    The problem is that the other var lotenum id dynamic so how can I concat the query to the array with var lotenum and then get the query result into var lotedisponible

  • the problem is in the lower part, you forgot get() there

    Code
    set(lotenum, get(hotspot[get(i)].lote));
    set(lotedisponible, get(datoslotifica[get(lotenum)].status));
    if(lotedisponible == 1,
        set(hotspot[get(lotenum].fillcolor, get(colorlote_disponible));
    , lotedisponible == 2,
        set(hotspot[get(lotenum].fillcolor, get(colorlote_apartado));
    , 
        set(hotspot[get(lotenum].fillcolor, get(colorlote_vendido));
    );

    or even better, use copy(a, b) which is a shortcut for set(a,get(b));

    Code
    copy(lotenum, hotspot[get(i)].lote);
    copy(lotedisponible, datoslotifica[get(lotenum)].status);
    if(lotedisponible == 1,
            copy(hotspot[get(lotenum].fillcolor, colorlote_disponible);
    , lotedisponible == 2,
            copy(hotspot[get(lotenum].fillcolor, colorlote_apartado);
    , 
            copy(hotspot[get(lotenum].fillcolor, colorlote_vendido);
    );

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!