How to add items to list without relacing the previous created list in dynamic list viewH

I want to add items to a dynamic list view that is already created without replacing the list already created.
replace data
like this… can anyone help me

Create one global variable,
After creating the dynamic component, set this global variable to get number. So now you are having the final number of your dynamic I’d.

Eg. For the above said case your global variable will set it as 3.

Now after adding new item just set this global variable to get variable +1 and use the same procedure for what you have used for the above three item…

2 Likes

Thankyou so much fro your reply. But the problem here is that the api data is in decending order so due to that the app is repeately calling the same data again and afain…
for example.

before adding any data to db
1.apple
2.orange
3.banana

*now some data is added to api
add in db = “pinapple”

now new api is
1.Pineapple ===> [ New data is added in no 1 instead of no 4 ]
2.apple
3.orange
4.banana

as you can see that in global variable the value was 3 and after calling new data we add +1 = 4 . and when we creat a list it will print banana 2 times… in no-3 and no - 4…

like this

1.apple
2.orange
3.banana
4.banana

Just do one thing , after getting API data into a global list just call reverse the list.

So new data will come down and old data will be at the top

2 Likes

Ups i made a mistake while asking a question can i made another Post. Cause this post literally messed up… well thankyou so much @Still-learning for your time :blush:
I am creating another post with clear quests and diagram… Hope you will help me with that.Thank you.

1 Like

If the query is no where related to this topic mean, you can create a new topic . Else you can continue to ask here

1 Like

Ya this is on the topic but What i actually did is made some mistake while asking questions. Let me continue here:

I mad list view with the help of dynamic components extension and call data.Now the problem here is every time a certain new data added to a api it automatically set its new data to the tope of the index in no 1. And other data that was in index 1 change its index to 2 and so on with other…

Now,when api add new data . I want to add that item at the top of the list in index 1 without refreshing the page and the previous items list will only change its index +1.Its like update data in real time. Can we do that.

Not impossible… quit easy… i hope you should use clock to check for new data in api. If new data found ,.Call the app to get data and prepare dynamic component based on length of the api data.

And you can use scroll handler extension to go down whenever data added to the dynamic comp

1 Like

Not i did it but it doesn’t work for me…
It add items at the end of the list instead i want to add it at the top and other items at the last… Here is example:

The concept is to add new items to index 1 and other item that is already created will change its index number. for example index one items will move to index 2 and index 2 item to index 3 and so on. But the screen should not be refreshed or the list view should not be re created again…Can we do that

If possible, show your dynamic block creation procedure

1 Like

Call data
Write in write in dynamic component using select list item list.

Check api data…
If new item found,
Clear all the dynamically created items. Call once again all data and repeat the procedure

So this will give you new item added at the too as first

1 Like

Ya but its refreshing the list view which is not what i want… I am not trying to refresh the list that is already created cause i am calling api in every 10 second to get new data. which will cause lag and app crash if we re creat list again and again.

Sure . But ignore start for loops start from cause i was tasting it weather it works or not:

I understand your problem… first create a dynamic component based on current value.

After refresh call data from api, get the first data alone and add to the existing component ,also by using set order block move the newly created item to the index 1

So as per this block now your dynamic id at beginning is 1,2,3 mean then after adding new item also by using the above block order of id will become as 4,1,2,3 the new item will be at the top…

Upon again refresh id order will become as 5,4,1,2,3

1 Like

Thank you for your reply i will try and post if ut work for me.

that is what i want thankyou so much and can you give me aia files please if i get confused i can see the aia…

This aia depends upon the text box but yours is depend upon api… so after setting dynamic components slightly need to adjust…

DemoDynamic.aia (35.4 KB)

After getting first time dynamic complimenti use three global variable one is global id , old id and another new item , initia all with empty string.

Once dynamic comonent created set this global id with get old id +1.

When api refresh, get the first item into the new item variable and create dynamic component with this global id, and set the order of very first component i.e compo created on VSA id to index 1 just like in aia…

This aia modified compared with apk… so you can understand a lot… did you ???

1 Like

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