have you replaced the place holders by your technical names in those scripts?
TEXT.setValue(DS.getFilterExt("<DIMENSION>")
APPLICATION.alert(DS_2.getVariableValueExt("<YOUR VARIABLE NAME>"))
I still do not understand why you want to pass the variable values to filter in the same data source. this is not required in normal case as the variables are pre-filtering.
if you start with 3 cities in default, where is the issue then - you can have dimension filter and user can change it in the application as he wants. there is no need to have any script.
Karol