CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 [SOLVED] Merging multiple fields?

Print topic Send  topic

Author Message
Shin

Posts: 6
Posted: 04/27/2015, 4:27 AM

Hi
I am still new to CodeCharge and I would like to get an advice about this issue.

I use Access database with ASP and there are 19 fields that contains name. I would like to display with divider after searching by keyword. My problem is not all the time those 19 fields have name, sometimes only 1 field, sometimes 2 or 3 fields.

If I put fields and text divider (for example '|' ) on CodeCharge, it would display like below;

Name A | Name B | | | | | |

Thats because there are only two name on the record. I tried to merge the field by SQL however Access has limitation of 255 bytes and cut the name in a middle if there are many name on particular record.

I would like to display all existing name on a record without unnecessary text divider.

I would really appreciate if someone can advise me to archive this.


Shin
View profile  Send private message
eratech


Posts: 513
Posted: 04/27/2015, 8:18 PM

Shin,

A couple of suggestions:

- you could add a Before Show action/code to the output label and replace all the extra " | |" characters
- concatenate the names in SQL (which should return any length result) and replace the " | |" in SQL
- use a SQL Case or IIF to return the name if it's not blank, otherwise return a blank string ("") or null (not sure if Access has CASE but from memory it has Immediate IF (IIF())
- does Access have ISNULL to check for null and only return a value if not null

Let me know how you go

Eric

_________________
CCS 3/4/5 ASP Classic, VB.NET, PHP
Melbourne, Victoria, Australia
View profile  Send private message
Shin

Posts: 6
Posted: 04/27/2015, 8:48 PM

Quote eratech:
Shin,

A couple of suggestions:

- you could add a Before Show action/code to the output label and replace all the extra " | |" characters
- concatenate the names in SQL (which should return any length result) and replace the " | |" in SQL
- use a SQL Case or IIF to return the name if it's not blank, otherwise return a blank string ("") or null (not sure if Access has CASE but from memory it has Immediate IF (IIF())
- does Access have ISNULL to check for null and only return a value if not null

Let me know how you go

Eric


Hi Eric,

Thank you again for response to my question.
It seems that SQL on Access has limitation for output text because I already tried making query with concatenate the names but it is cut off after 255 bytes.
I tried to do using "Before Show" function, but I am not exactly sure how I can do it.... Do I need to write the code? If that's the case, could you please advise about it bit more as I am not familiar with programing much...

Regards,

Shin

View profile  Send private message
eratech


Posts: 513
Posted: 04/28/2015, 11:35 PM

Shin,

Ok, I would suggest adding an event to the 'Before Show' with Action 'Retrieve Value for Control' with something like the following for a label or textbox called 'longnames' in a Record called 'Users'

Control: longnames (you can also leave this blank if you are adding the Action to the 'longnames' label/control and it will assume it)
Source Type: Expression
Source Name: Replace(Users.longnames.Value," | |","")

Double-click on the action after you have done this and CCS will take you to the code - see how CCS puts what you have entered together with it's own code.

(Strongly recommend you check the help file for the run-time properties of Textboxes and the Actions with sample code in ASP, PHP, Java, etc etc)

Also, if you are not sure of the code, you can always add an Action that might be similar to what you want, copy it out and then delete the action and add Custom Code where you can code what you wish. I've used that a lot when moving from one language to a new language to get some pointers.

Cheers

Eric
_________________
CCS 3/4/5 ASP Classic, VB.NET, PHP
Melbourne, Victoria, Australia
View profile  Send private message
Shin

Posts: 6
Posted: 04/29/2015, 4:47 PM

Hi Eric,

Thank you for your advice.
I figured it out how to archive it by beforeshow with putting some code. I made a code with 'If' function and it seems quiet long but it works so leave it for the moment and re-organise it in the future.

Thank you again for your help.

Shin
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.