Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

selecting data

Status
Not open for further replies.

RPOC

IS-IT--Management
Jun 17, 2003
44
US
I am using crystal reports 9 and am accessing a set of tables via an odbc connection.

I am printing a report and it contains a pass thru parameter from another program. that parameter is parsed to look like a series of numbers then a tilde then a series of number tilde etc. Example 12~444~239~22 This series can contain 1 value or many. I need to take these numbers and compare it to another table via an odbc connection to extract an epiration date and a more formal number.
I then need to get these items to print on 1 label, along with other data from other tables. I did create a formula to parse out the numbers. When i placed this on my label and ran it i had multiple labels print. I found that I am getting 1 label for every comparision in the odbc connection table.

I wanted to know if anyone new how to overcome this. I basically want the formula to run populate my global variables and print all the data on 1 label.

In my experimentation I found , If i only had 1 number in my parameter I could use a select record option and my label works fine. Unfortunately the quantity of numbers in the parameter will not be 1.
any help would be appreciated.

 
A value like 12~444~239~22 can be made usable using the SPLIT command - use your HELP for details. Also UBOUND will tell you the number of elements, would return 4 in this case.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 11.5 with SQL and Windows XP [yinyang]
 
Thanks for the split and ubound information. I did look it up and these two command will be useful. I am not familiar with selecting multiple variable from a table. Would i create a formula then use the split/ubound statements to extract the data i need or would i incorporate this into the crystal Report Select Expert? Or maybe a combination of both?

Sorry about being so ignorant on this . As I stated I never done this before.
 
Any formula based on just one detail line can be used in Record Selection.

Select Expert is useful for starting out but is limited. Look under Report on the menu and you should find Selection Expert > Records.

This is based on Crystal 11. It helps to give your Crystal version - 8, 8.5, 9, 10, 11 or whatever. Methods sometimes change between versions, and higher versions have extra options.


[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 11.5 with SQL and Windows XP [yinyang]
 
i currently have 2 other formulas located there.

out of curiosity if this was one parameter how would you check the data if it has to be split. The below is the logic i used . i placed this into a subreport and am trying to extract the values back to the main. I tested the logic and that is fine but for some reason the variable is not being passed.

shared numbervar counter;
shared stringvar array bottles;
shared numbervar countofbottles;
shared stringvar bottleid;
shared stringvar Parm;
shared datevar expdate1;
shared datevar expdate2;

countofbottles := ubound(split(parm,"~"));
redim bottles[countofbottles] ;
for counter :=1 to countofbottles
do
(
bottles[counter] :=split((parm),"~" )[counter] ;
IF bottles[counter] ={table_inventory.BOTTLEID} then


if not isnull ({table_inventory.expiration_date}) then

if ({table_inventory.expiration_date}) < expdate1 then
expdate1 := {table_inventory.expiration_date}

);
 
I'd split the formula into several separate formula fields. You could do the test within the subreport and confirm you have the value, or values.

If the value is there in the subreport but not the main report check:
a) Do you have the same variable name
b) Are you testing it in a section below the section that calls the subreport?

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 11.5 with SQL and Windows XP [yinyang]
 
I figured out what was going on. The programmer sent a spec over indicating the values will have "~" splitting the data. When i was testing output, I noticed it was using "&" . I modified the formulas and it worked.

thanks for the help. I appreciate it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top