getBillingAddress can't get rid of null values in OpenVPMS and ireports
Submitted by larsrikart on Tue, 29/05/2012 - 09:10
Hi
When I use getBillingAddress I get a reply similar to "street streetnumber null null postcode city".
In the OpenVPMS UI when a client is chosen the adress have the "null values" and also if I get the adress in iReport I have the null values in the second line of the adress of e.g. invoice a4 logo template.
I tried using variables and expressions in iReport to remove them without luck.
I tried to change the settings in archetypes to remove them.
Any ideas how to get rid of the "null"?
Lars
Re: getBillingAddress can't get rid of null values in ...
I have been looking at the code, here is what I think is happening,
When an address or contact.location is returned, during formating a lookup is performed on your suburb/state lookup table.
In the contact the state and suburb are NOT actually stored as the actually values, they are stored as a code that allows the system to lookup the correct value, this is done to meet database rules regarding 1st Nominal form but you dont need to worry about why. All you need to is make sure that when your staff enter Suburbs, States and Postcodes that they are using the lookups correctly and that you havent gone through and manually removed some of those lookups.
For examply
my Address is
123 Somewhere Rd, Hendra, QLd, 4011
in my contact that is stored as
address = 123 Somwhere Rd
suburblookup = HENDRA_4011
postcode = 4011
when the address is printed on a report the system does a lookup of HENDRA_4011 and finds that the entry has the following records
State = QLD
Suburb = Hendra
PostCode = 4011
If there was no record then a null would be returned.
I would cross check your lookups for suburb / state and postcode data and check you contacts for inconsistencies and missing entries. As to how that might have happened I am not so sure
I suspect deleting lookups might be the cause , in future ALWAYS use the REPLACE button
I noticed when I imported data I had a heap of misspelllings I had missed in conversion that lead to multiple lookups for the same suburb
ie
Hendra, QLD 4011
and
Henda QLD 4011
I simply replaced the incorrect lookup with the correct which I believe will change all the concacts using the incorrect listing with the correct one.
Re: getBillingAddress can't get rid of null values in ...
Follow up question what have you entered in the POSTCODE FIELD of address's ,
Reason: why do u have address's with a city after the Postcode??
Re: getBillingAddress can't get rid of null values in ...
The actual problem is a little more complicated. If you are entering location details for an address in another country, there will be no state or suburb entered (since the system holds no state and suburb details for that country) and the complete address details will be entered in the Address field.
When the billing address appears, you do not want 'null' shown for the missing state and suburb. Thus for an address entered as:
42 Scenic Villa
Scenic Villa Drive
Pok Fu Lam
Hong Kong
You should not get "42 Scenic Villa Scenic Villa Drive Pok Fu Lam Hong Kong null null"
It would also be nice if the handler inserted commas replacing the new lines when generating for the customer details, ie "42 Scenic Villa, Scenic Villa Drive, Pok Fu Lam, Hong Kong"
Re: getBillingAddress can't get rid of null values in ...
The 'null' in the address field is not ideal, but it does highlight the fact that you are missing data.
I've raised OVPMS-1242 to change this.
As for the way the address is formatted, would it help if this was configurable?
Re: getBillingAddress can't get rid of null values in ...
It would help if the adress was configureable(in OpenVPMS) but also if it was possible to get the parts alone. E.g. exchange GetBillingAddress with calls to get the parts of the adress would be welcome for reports.
Danish addresses and many european is in the following format
"roadname housenumber
village (sometimes or other second line adress)
postalcode city"
e.g.
"Strandboulevarden 117
2100 København Ø"
Best r.
Lars
Re: getBillingAddress can't get rid of null values in ...
Tim A:
a) null does say that there is missing data; however I think that you would agree that with a foreign address (where you do not have the postcode data loaded for that country [and the system currently provides no way to select the country]) then the suburb, state and postcode will always be null.
b) configurable address formatting - yes please!
Regards, Tim
Re: getBillingAddress can't get rid of null values in ...
Prior to 1.0 we did have support for multiple countries in addresses; see the lookup.country and lookupRelationship.countryState archetypes. It was removed as it wasn't required by initial deployments.
It could be added back if required.
For the configurable address formatting, I've created OVPMS-1248
Please review it and post any comments here. When there is consensus, I'll cost it and create a project.
Thanks,
Tim
Re: getBillingAddress can't get rid of null values in ...
I see no need at all to add a country select in the address. Its useless unless one has a full set of postcode data for that country, and one is always going to have the problem that Murphy will have an address in a country for which you don't have the postcode data.
My recommendation - don't re-instate country selection.
Regards, Tim G
Re: getBillingAddress can't get rid of null values in ...
I've created a project for address format customisation here
-Tim