Click here to Skip to main content
12,890,879 members (56,730 online)

how to set Formula field value in to Paramater

Mits Machhi asked:

Open original thread
Hello To All,

I have a Crystal report in which i use Add command with 2 parameters.

1. for Database
2. For Days ( Selection Criteria)

now, when i run the report there is a selection parameter to select the company. and enter the number of days.

when user select the company, in behind i want to set that company database into add command by some parameter.

so, how can i achieve this ?

e.g :

select company : 1.AAA 2. BBB 3. CCC
AAA have database name"one","second" and "third" respectively.

i use the command like below:
SELECT     stocklederview.itname AS itemname, SUM(stocklederview.qtyin) AS qtyin, SUM(stocklederview.qtyout) AS qtyout, SUM(stocklederview.qtyin)- SUM(stocklederview.qtyout) as qty, stocklederview.unit AS unit, MAX(stocklederview.docdt) AS maxdt, itmast.material,
itgroup.dtldesc, gdmast.gdname
FROM        {?db}.dbo. stocklederview INNER JOIN
                      itmast ON stocklederview.itcode = itmast.itcode INNER JOIN
                      itgroup ON itmast.itgroup = itgroup.code INNER JOIN
                      gdmast ON stocklederview.gdcode = gdmast.gdcode
GROUP BY stocklederview.itname, stocklederview.unit, itmast.material, itgroup.dtldesc, gdmast.gdname
HAVING      SUM(stocklederview.qtyin)- SUM(stocklederview.qtyout) > 0 and (MAX(stocklederview.DOCdt) <= DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE() - {?DAYS})))
ORDER BY stocklederview.itname

here is two parameter, so when user select AAA then in this command "one"database must set in place of "{?db}".

please help me....
Tags: CrystalReports


When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the The Code Project Open License (CPOL).

Advertise | Privacy | Mobile
Web02 | 2.8.170424.1 | Last Updated 26 Mar 2009
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100