[SOLVED] Change a string http request


I need to modify my input from a http request on my string Item

String	GoogleMaps_me_duration				"Duration [%s]"		(gGoogleMaps)	{ http="<[https://maps.googleapis.com/maps/api/distancematrix/json?origins=Amsterdam&destinations=Rotterdam&language=NL&departure_time=now&traffic_model=best_guess&mode=driving&key=YOUR_API_KEY:300000:JSONPATH($.rows[0].elements[0].duration.text)]" }

On my item i get the state “76 mins”, is there a way to change this to “76” so without the mins?

Because you already have a transform on this to get the “76 mins”, your only option is to use a Rule and a proxy Item. When GoogleMaps_me_duration changed trigger a Rule that strips off the mins and updates some other Item. This new other Item becomes the one that you need to use everywhere else.

val removedMins = GoogleMaps_me_duration.state.toString.split(" ").get(0)

I will try.