I hope you Have Party Name wise Correct data in following way:
Party Name Correct City Correct State
So Use apply Map Two Times As Below:
[Correct City ]
[Correct State ]
Use apply Map into your base table two times one for city and one for state
ApplyMap('CityMapping','[Party ID]',City) as CorrectCity,
ApplyMap('StateMapping','[Party ID]',State) as CorrectState
If(State ='KARNATAKA', 'BANGALORE',If(State ='DELHI', 'DELHI', City)) as City,
If(City ='DELHI', 'DELHI', State) as State,
If(City ='DELHI', 'ASIA', Continent) as Continent
You can use DynamicUpdateCommand in Macro like this
SET Result = ActiveDocument.DynamicUpdateCommand ("UPDATE Table SET city = 'BANGALORE' WHERE factory='G' and party_name='b' ")
This Macro works in Ajax Mode as well.
You can link this Trigger on OnOpen Doc or Botton Action.