Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I'm trying to replace all instance of the word "JJ" or "Jay Jays" with the word "Refinery" in my module. But these will not be the full field values, so the store name for instance may be "JJ - Cape Town" which I then want to change to "Refinery - Cape Town".
These are on multiple fields so I do NOT want to use the REPLACE function, I want to use the "MAP USING" function.
For some reason it's not working, and I think maybe because I need wildcard characters since I'm only replacing PART of the field values.
Currently I have the following:
RefineryMap:
Mapping LOAD
*
INLINE [
MapString, MapValue
JJ, Refinery];
MAP * using RefineryMap;
Data:
LOAD
*normal load script*
Unfortunately, you cant do that. Map Using will always look at the entire string. You will have to do it field by field, either by Replace or MapSubstring. You surely can't have that many fields containing these names?
This is from the QV Manual, which surely implies I can do it?

And yes, it is unfortunately in a lot of fields. It is the name of a company that is changing, and it is referenced in store names, company codes, transaction descriptions, free text comments, etc...
That is for Map Using which looks at the entire field. The wildcard selects the fields to be mapped, not the field contents where the mapping happens. For example
Map A* Using ....
will apply the mapping to the fields A1, Abracadabra, but not B1 or CompanyName. But it will look at the entire content of these fields for the mapping lookup - which is not your requirement in your original post.