如何在cfquery名称中输出控制变量? [英] How to output with a control variable inside cfquery name?

查看:95
本文介绍了如何在cfquery名称中输出控制变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿所有人,


我输出报告时遇到问题,希望有人能解释我做错了什么。


报告的内容是将我公司的零件价格与d和h,synnex和techdata进行比较。我被告知要做的是部分编号,并将它们与d和h,synnex和techdata结合起来,只显示一列零件(这样做)。然后我被告知使用我创建的查询来创建一个cfloop来组合各个部分(这样做)。然后在cfloop里面我为每个公司创建了一个cfif,做cfif是为了得到每个公司的价格(这样做)。然后我被告知要添加一个循环控制变量,这样如果一个价格是空的,它将跳过它而不是添加下一个价格。


问题是我能够得到一个价格输出,但现在我不能得到任何价格输出,不知道我做错了什么。在我添加循环控制变量之前,我能够通过#techdata.cost#输出techdata的价格,但现在使用循环控制变量我无法做到。在添加循环控制变量之前,我也无法输出synnex和techdata,但我被告知我输出它的方式可能就是问题所在。如果有人能告诉我我做错了什么,至少我如何展示techdata我会非常感激。这是我目前所拥有的。

Hey Everyone,

Well i am having a problem outputting for my report and hoping someone can explain what i am doing wrong.

What the report is about is comparing my company''s part price''s to d and h, synnex and techdata. What i was told to do was take are part numbers and combine them with d and h, synnex and techdata to display only one column of parts (did this). Then i was told to create a cfloop using the query i created to combine the parts (did this). then inside the cfloop i created a cfif for each company, doing the cfif is suppose to get the price for each company(did this).Then i was told to add a loop control variable so that if one price is empty it will skip it instead of add the next price.

The problem is that i was able to get one price to output, but now i can not get any of the prices to output at all an not sure what i am doing wrong. Before i added a loop control variable i was able to output techdata''s prices by doing #techdata.cost# but now with the loop control variable i am not able to. I was also not able to output synnex and techdata before adding the loop control variable, but i was told that how i was outputting it could be the problem. if anyone could tell me what i am doing wrong, atleast to how i am displaying techdata i would really appreciate it. Here is what i currently have.

展开 | 选择 | Wrap | 行号

推荐答案

部分代码没有'没有意义。例如,在第38行,你增加变量t,但为什么?在下一轮循环中,它将被设置回1(第27行)。对于d和s也是如此。


还有一些其他问题,但首先,你能发布一些示例数据以使事情变得更容易。
Some of the code doesn''t make sense. For example, on line 38, you increment the variable t, but for what? In the next loop round, it''s going to be set back to 1 (line 27). This is the same for d and s.

There''s some other problems too, but first, can you post some example data to make things easier.


嘿Acoder,


很难真正发布数据库中的例子,因为它很乱,很难让它出现。但我可以告诉你一个例子。基本上每个公司我的,techdata,synnex和d和h都有自己的零件编号。但是,有许多具有相同的部件号,所以我将所有相同的部件组合在一起。然后我需要得到techdata,synnex和d和h的价格。当我得到价格时,价格必须与零件相匹配。 (基本上得到了与部分相关的价格)。一些部分没有这个部分的价格,所以它必须能够通过简单地留一个空间来解释它。现在虽然如果我提出产品将匹配价格,但如果价格缺失它将不会考虑它,所以它将采取下一个价格添加它在空白点而不是留空。 #t#假设做空白部分(至少是我被告知的那个),但它对我没有任何影响,这就是为什么我决定问,因为我不认为它是正确的。


所以这是一个如何出现的例子


零件编号是零件和techdata,synnex和d和h列出


他们对该特定零件号的价格是多少。有些公司可能没有特定部分的价格,因为他们没有那个特定的部分。


Hey Acoder,

Well its hard to really post examples from the database because its a mess, and its hard to make it come up. But i can tell you an example. Basically each company mine,techdata,synnex and d and h all have are own part numbers. However, there are many that have the same part number so i combined all the ones that are the same. Then i need to get the price for techdata, synnex and d and h. when i get the price the price has to match up to the part. (basically got to get the price that is suppose to be with the part). an well some parts will not have a price for that part so it has to be able to account for that by simply leaving a space. Right now though if i brought it up the products will match the price, but if a price is missing it will not account for it and so it will take the next price an add it in the blank spot instead of leaving it blank. the #t# was suppose to do the blank part (atleast that is what i was told), but it didn''t make any since to me which is why i decided to ask because i don''t think its right.

so heres an example of how it should come up

the part number is the part and techdata, synnex and d and h are listing

what price they have for that particular part number. some companys might not have a price for that particular part because they don''t have that particular part.


展开 | 选择 | 换行 | 行号


好的,你能解释第29,42和54行的比较几行的价值吗?


我也注意到了别的东西。例如,您将t设置为1,但随后它会增加,因此第78行的查询名称为techdata2而不是techdata1。
OK, can you explain lines 29, 42 and 54 where the distiid value is compared?

I''ve also noticed something else. You set, for example, t to 1, but then it''s incremented so the query name on line 78 is techdata2 instead of techdata1.


这篇关于如何在cfquery名称中输出控制变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆