I’m anxious

Model & Storage

Hey All,
I have a slight issue.

Basically, I have 3 models in my app (screenshot);



If I use the usual clear.localstorage(); it'll clear out everything, I do not want this to happen.

Instead in HTPShed_Storage, I have multiple entries, but need to clear only: SizePattern.



I have looked everywhere and I can only find the 'clear everything' option, but I do not want to do that, I just want/need to clear 1 item only!!

Suggestions?

Thank you,
  - Tech-Xcellent
1 person has
this question
+1
Reply
  • Hello,

    Sure, it is possible to reset a value for only one Storage variable, please use a Storage update method for that. Please look at this link how to use it: https://docs.appery.io/docs/appbuilde...
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited sad, anxious, confused, frustrated

  • This reply was removed on 2016-08-14.
    see the change log
  • This reply was removed on 2016-08-14.
    see the change log
  • Thank you Sergiy,
    If I understand this correctly.

    DevCentre:

    var paramName = "FirstName";

    Apperyio.storage.storageVariable.get() //returns {"FirstName":"Sam","LastName":"Winchester"};
    Apperyio.storage.storageVariable.update("$['"+paramName+"']", "Billy");
    Apperyio.storage.storageVariable.get() //returns {"FirstName":"Billy","LastName":"Winchester"};

    My 'paramName' would be: SizePattern

    var paramName = "SizePattern";
    Apperyio.storage.storageVariable.get()
    Apperyio.storage.storageVariable.update("$['"+SizePattern+"']", "null");<br>
    Apperyio.storage.storageVariable.get()

    Would this be correct?
    Would that be how I 'clear' SizePattern of anything stored there?

    Suggestions?
      - Tech-Xcellent
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited sad, anxious, confused, frustrated

  • Please use:
    Apperyio.storage.storageVariable.update("$['"+SizePattern+"']", "");


    instead of:
    Apperyio.storage.storageVariable.update("$['"+SizePattern+"']", "null");


    To remove this value
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited sad, anxious, confused, frustrated

  • Thank you Sergiy,

    Do I need to include the rest of the code?

    Apperyio.storage.storageVariable.get();
    Apperyio.storage.storageVariable.update("$['"+SizePattern+"']", "");
    Apperyio.storage.storageVariable.get();

    The reason for asking,
    I just tried the code you suggested, on a 'click' event assigned to a button and the navigationTo isn't working any more and the developerConsole reports as error with the code itself, stating "ReferenceError: SizePattern is not defined" (screenshot attached).

    Am I meant to replace 'storageVariable' with something else? The name of the model?

    Or am I missing something?

    Please advise?







    Thank you,
     - Tech-Xcellent
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited sad, anxious, confused, frustrated

  • Sorry, I don't see anything on screenshots you've sent.

    Did you define a variable "SizePattern"?
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited sad, anxious, confused, frustrated

  • SizePattern is the name in model and storage.

    As per the first screenshot.

    It's named SizePattern, so I would imagine it's been defined unless I am missing a step?

    If there is a step to 'define a variable' from model and storage, please advise?

    Thank you,
     - Tech-Xcellent
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited sad, anxious, confused, frustrated

  • Good Afternoon Sergiy,
    I have solved the issue at hand.

    I didn't use any Appery.io code,

    Instead used java, the code I used (and it works a treat) is: $(':input[name=""]').val(null);

    To anyone else who wishes to use, add in the name of your component between "" eg: "SizePattern"]') etc...

    If unsure how to use, shoot me a message.

    Thank you,
     - Tech-Xcellent
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited sad, anxious, confused, frustrated