Dictionary structure

Hi, I love dictionary but probably I don’t know some rule. I’m going mad :rofl:

With my app I want to save product by barcode and name and save the price by date
This is my block I used to save product when it doesn’t exist

This is my block when product exists and I want to add a new price in a new day or in the same day ) I created it , like update.

I see the guide about dictionay and (if I understood well) if the last key in the path exist it updates the value, if the last key in the path doesn’t exit it will create a new one . This works only for the last key, it’s right?
Well if I test the code in the day of the first add (when it doesn’t exist) and try to add a new one (changed the time with the add day block) it works fine . I tested yesterday, you can see in the db 2 items under PREZZI , 14 and 15, with their values.
I update my apk ,saved items, yesterday I added a product and a price and today when I tried to add a new price got error : Expected a list or dictionary, but found a null when walking path.
I made some test and I can find the keys , it can’t walking year and month and day . Why if I can see it in my db?

It can’t see day,month and year, if I get off them the walking is right and show also the data 2023 marzo and the 2 items

Which is my error?
Thanks

Edit I tested also before with 2 item and it doesn’t work , no update (15 is just in dB) and also with one item, new price (with only 14 in dB)
Yesterday all work fine , add , update and also new product using add day block of the clock

Some hint? There is some error in the way ai stored the data ?

What can I try to fix this problem ?

Really , I don’t know how to go on
Here the aia test, please don’t focus on other things but only the date path and why I can’t get (but I see) the date items , this is a part of all my code. How I have to change the save path ? Which is my error?
Thank you
test.aia (12.7 KB)

@Still-learning usually I don’t like to tag but I don’t known how to go on ,thanks

I tried also with a variable but nothing

yes, me too noted… It accepts 2023 as a sting but doesnot accespts through clock

EDIT:

I have solved just by using trim function also changed your set textbox clear too

testtt(2).aia (14.5 KB)

i have used procedure blocks to reduce the blocks usage

1 Like

i hope your problem have been resolved… right? @Raffaele_Gold

1 Like

I will see tonight ,thanks for now​:sweat_smile: so is a problem of space added somewhere?

:joy: :joy: Really I don’t know why . To work right I have to use trim in get value and in store blocks or without trim as original code. With trim only in get value it doesn’t work .

Thanks for your code, I like to learn how power users work, I mean professional people and not amateur like me. This is only an aia test but your code is always more elegant than my main code
:pray: thank you

Do you believe me when I say I’m going crazy ? :sweat_smile:

1 Like

I change my code with the trim block and I will test the app for days. After I will update you about the solution :muscle:t2:

1 Like

While you save the value in dictionary, there is no need of trim… you must use only at the time of reading from path

1 Like

Ok, but as you can see in the video, yesterday night with trim only in get path give me not found , worked only with trim in both position . The video is about your aia without changes and after I tried to add the trim block in store block too . But is a no sense way as you suggested me :man_shrugging:t2:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.