Adding 2 Varchar fields and result in 3rd field

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
User avatar
RonP
Veteran Member
Posts: 219
Joined: 2013-08-27 13:36
Location: Heiloo, The Netherlands
Contact:

Adding 2 Varchar fields and result in 3rd field

Post by RonP » 2014-07-14 13:57

Hello,

I've a problem with adding 2 Varchar fields to a third field.
What I do is:

Code: Select all

	function artikelen_before_insert(&$data, $memberInfo, &$args){
$data['samen'] = ($data['artikel'] + $data['artikelnummer']);
		return TRUE;
What happens is that anly the value of de last field

Code: Select all

$data['artikelnummer']
is displayd in:

Code: Select all

$data['samen']
I think that I have to do something else for geting the "whised" result.

Field samen is Varchar(100)
Field artikel is Varchar(40)
Field artikelnummer is Varchar(40)

What I also want is a "seperator" in field [samen] between the values artikel and artikelnummer and get rid of possible "blancs" at front / rear
Artikel:Car
Artiklenummer: 1234567
Samen --> Car - 1234567

Ron

User avatar
a.gneady
Site Admin
Posts: 1281
Joined: 2012-09-27 14:46
Contact:

Re: Adding 2 Varchar fields and result in 3rd field

Post by a.gneady » 2014-07-15 00:31

Try:

Code: Select all

$data['samen'] = trim($data['artikel']) . ' - ' . trim($data['artikelnummer']);
:idea: AppGini plugins to add more power to your apps:
  • DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
  • Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
  • Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.

User avatar
RonP
Veteran Member
Posts: 219
Joined: 2013-08-27 13:36
Location: Heiloo, The Netherlands
Contact:

Re: Adding 2 Varchar fields and result in 3rd field

Post by RonP » 2014-07-15 12:55

Hi a.gneady

It works well. Thanks

Ron

Post Reply