CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 SOLVED - GetValue from string

Print topic Send  topic

Author Message
infobih

Posts: 58
Posted: 07/27/2010, 2:10 AM

Hello

I have one Grid with one field called "flags". This field contains string like

- - - ? - - - - H - or
- D - - - - - - - - etc etc

I have created one label named "flag"

How can I acheive to display in label only one letter from string "flags" (Before Show Event)

For example if field "flags" value is - D - - - - - - - - then display "D" in this label, otherwise another letter;

Thank you very much in advance

View profile  Send private message
mamboBROWN


Posts: 1713
Posted: 08/15/2010, 7:42 AM

infobih,
Are you grabbing a specific character from the flags field?? If so, you could use a php function( substr(string,start,length) ) or a mysql function ( LEFT(str,len) and make it a part of your datasource ).
View profile  Send private message
infobih

Posts: 58
Posted: 08/15/2010, 8:14 AM

Hi mamboBROWN


Yes,it is exactly what I want. In my example I need to get letter "H" for string - - - ? - - - - H - , or letter "D" for string - D - - - - - - - -

How can I create loop case with that function?

Thanks
View profile  Send private message
mamboBROWN


Posts: 1713
Posted: 08/15/2010, 8:47 AM

infobih,
Is there a set position that you are grabbing the character from or does it always vary?
View profile  Send private message
infobih

Posts: 58
Posted: 08/15/2010, 9:05 AM

Grid = "mygrid"
Field concerned in the Grid named "flags", i've got from database

I have only three different strings, always the same order of characters

---?----H-
---Z------
-D--------

I need to display H, D, Z from the string in the field "flags" depending of the value from database.

Thank you in advance
View profile  Send private message
mamboBROWN


Posts: 1713
Posted: 08/15/2010, 10:10 AM

infobih,
Add the bolded section to your MySQL query:
select case when instr(flag,'H')>0 then 'H' when instr(flag,'Z')>0 then 'Z' when instr(flag,'D')>0 then 'D' else ' ' end as Theflag from gridtable

KEY: flag is the string field, gridtable is the table name, Theflag is the query field name.

Depending on what case is true it will return eith H, Z or D.
View profile  Send private message
infobih

Posts: 58
Posted: 08/15/2010, 11:06 AM

Thank yoy mamboBROWN

Ii works very well with 20K records table.
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.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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