1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XMLVars Question

Discussion in 'Gauges' started by j_relax, 25/7/12.

  1. j_relax

    j_relax

    Joined:
    22/7/12
    Messages:
    11
    Country:
    unitedstates
    hi, first of all, thanks to the creator of this great tool. i was wondering if there is a way to delete records, other than overwriting current records or using (>C:XMLVARS:Reset)
  2. rpmc

    rpmc

    Joined:
    14/10/07
    Messages:
    760
    Country:
    thailand
    I second your thoughts about Tom's module. I am positive he will also respond to your question, but I had the same question a few months ago.

    You can erase individual XMLVars by writing a null string to them:

    Code:
    [COLOR="Green"]'XMLVAR_AnyName' (>C:XMLVARS:SearchVarName, string)[COLOR="Red"][B] '' [/B][/COLOR](>C:XMLVARS:StringValue, string)[/COLOR]
    where '' is two single quotes with no space in between. Same works for number variables.

    The example above first locates the index for XMLVAR_AnyName, and then writes '' to it. It does not store a zero or a space in the contents ... it erases the contents of XMLVAR_AnyName just as 1 (>C:XMLVARS:Reset) erases all of the XMLVARs. Just make sure you have the latest version of XMLVARs as the initial (beta maybe) version did not have this capability.

    Hope this helps,

    Bob
    Last edited: 25/7/12
  3. j_relax

    j_relax

    Joined:
    22/7/12
    Messages:
    11
    Country:
    unitedstates
    You can erase individual XMLVars by writing a null string to them:

    Code:
    [COLOR="Green"]'XMLVAR_AnyName' (>C:XMLVARS:SearchVarName, string)[COLOR="Red"][B] '' [/B][/COLOR](>C:XMLVARS:StringValue, string)[/COLOR]
    where '' is two single quotes with no space in between. Same works for number variables.

    The example above first locates the index for XMLVAR_AnyName, and then writes '' to it. It does not store a zero or a space in the contents ... it erases the contents of XMLVAR_AnyName just as 1 (>C:XMLVARS:Reset) erases all of the XMLVARs. Just make sure you have the latest version of XMLVARs as the initial (beta maybe) version did not have this capability.

    Hope this helps,

    Bob[/QUOTE]

    Thanks, does that work on arrays too? or would it just delete the index and reorder them?
  4. taguilo

    taguilo Resource contributor

    Joined:
    20/10/06
    Messages:
    1,011
    Country:
    argentina
    Hi,

    In simple terms, arrays are automatically managed by the module, so it is not necessary to reorder/reindex unless you need to delete/insert intermediate array records and keep them in sequence. In this case, you can take a look at XMLVarsexample.xml; there are a couple of macros showing the way (one at least) to deal with this kind of process.

    Now, what Bob stated is correct; you can send '' to clear a variable's string content, or 0 to clear its numeric value; however the name (index) of the variable remains active. I am going to release an update soon that will allow to clear the variable slot as well, bringing the possibility to assign a new var name (index) and value(s) into that position. This could be very useful in case one needs to work with tables containing multiple rows and columns; then the space used by one table could be cleared and reused by another one, all within the limit of 1024 records in total.


    Tom

Share This Page