I want replace only first occurrence in text

In my text I have multiple time “basketName” I want replace only first basketName text with other text, please help me.

Not clear to us… please show us in screen shot your database and explain detail also show us what have you tried

I did it in App Inventor but it works the same in Kodular.

Peter’s example is s good start, but it does not work anymore if there is some other text like

Bla bla bla basketName test1 test2 basketName and some more text

Enhance Peter’s example to your needs…

Taifun

2 Likes

image

1 Like

I have try this but this solution change the all stored text in label.

bellow is text sample: (I want replace first basketName with basketName1 second with basketName2 and three with basketName3 and continue more with 4,5,6,7…

“customerId”:“24360”,“basketId”:“252913”,“basketName”:“Rafique 44”,“parentBasketId”:“107693”,“creationDate”:“18/11/2022:09:32:07am” ,“customerId”:“24360”,“basketId”:“252913”,“basketName”:“Rafique 44”,“parentBasketId”:“107693”,“creationDate”:“18/11/2022:09:32:07am” ,“customerId”:“24360”,“basketId”:“252913”,“basketName”:“Rafique 44”,“parentBasketId”:“107693”,“creationDate”:“18/11/2022:09:32:07am”

Our question is, Why do you want to change it? You obtaining the above value as json list it seems then just make a list from it then you add custom name … for simple work you are looking for complex work/block

That’s why we asked you early show us your db and expectations. Also if you have tried anything then show us your blocks too

I also try with jsontool but json tool collecting the last value from basketName tag there is not index in myjson string.

It clears that you are using the blocks in wrong manner. Show us your blocks. Else share us your json or api link, we will suggest you

my json demo text:

{“customerId”:“24360”,“basketId”:“131083”,“basketName”:“Rafeek Redfox”,“parentBasketId”:“107693”,“creationDate”:“07/04/2021:07:25:29pm”,“managedBy”:“Ramesh Kumar”,“emailId”:“NA”,“firstName”:“ASHISH CHANDRA”,“lastName”:“PUNETHA”,“mobileNo”:“NA”,“totalSims”:“497”,“activeSims”:“485”,“availableSims”:“12”,“testModeSims”:“0”,“safeCustodySims”:“0”,“inActiveSims”:“0”,“inProgressSims”:“0”,“suspendedSims”:“0”,“basketPermission”:“ADMIN”,“customerId”:“24360”,“basketId”:“131083”,“basketName”:“Shankar”,“parentBasketId”:“107693”,“creationDate”:“07/04/2021:07:25:29pm”,“managedBy”:“Ramesh Kumar”,“emailId”:“NA”,“firstName”:“ASHISH CHANDRA”,“lastName”:“PUNETHA”,“mobileNo”:“NA”,“totalSims”:“497”,“activeSims”:“485”,“availableSims”:“12”,“testModeSims”:“0”,“safeCustodySims”:“0”,“inActiveSims”:“0”,“inProgressSims”:“0”,“suspendedSims”:“0”,“basketPermission”:“ADMIN”,“customerId”:“24360”,“basketId”:“131083”,“basketName”:“Rakesh Kumar”,“parentBasketId”:“107693”,“creationDate”:“07/04/2021:07:25:29pm”,“managedBy”:“Ramesh Kumar”,“emailId”:“NA”,“firstName”:“ASHISH CHANDRA”,“lastName”:“PUNETHA”,“mobileNo”:“NA”,“totalSims”:“497”,“activeSims”:“485”,“availableSims”:“12”,“testModeSims”:“0”,“safeCustodySims”:“0”,“inActiveSims”:“0”,“inProgressSims”:“0”,“suspendedSims”:“0”,“basketPermission”:“ADMIN”}

Are you sure, you are getting this only as output or you merged anything. Because it doesn’t proper structure (object & elements orderly)

Paste your obtained json here and see the output

complete link for my json string:

https://thebigbrains.com/apps/iot2/basketDetails2.php?lkey=h1503s98c3448-602426112758f6529j-rk&bID=

There you are. This is pakka json. So you can use list by walking key path block to prepare required field as a list then do as you like. Here i have taken all the players name as a list and have used their place value infornt of it

First decide what are the fields you want to take from this json then create that much global variable and add blocks. Once list was ready from the list you can achieve what else you want. I have not used any y extensions, just default block (web component line is enough)

1 Like

waaaw its amazing, thanks :blush:

1 Like

Try to use the blocks just shown in above picture. If you ddint success then don’t hesitate to let us know. We will help u

This post was flagged by the community and is temporarily hidden.