子报告中的重复项(Duplicates in sub-report)
我有水晶报告,里面有一份子报告。 子报告显示重复项。 为了避免我使用下面的公式。
{table.IDField} = previous({table.IDField})
现在,删除重复项,但我在页脚中有字段的总和。 所有重复值都将添加到总和中。 有没有办法可以在子报告中选择不同的记录?
I have crystal report with a sub report in it. The sub report is displaying duplicates. To avoid that I used below formula.
{table.IDField} = previous({table.IDField})
Now, duplicates are removed but I have sum of the field in the footer. All the duplicate values are added to the sum. Is there a way that I can select distinct records in the sub report?
原文:https://stackoverflow.com/questions/35341186
最满意答案
是的,这是可能的(如果我理解正确的话。问题有点不清楚)
您需要做的第一件事是在脚本的顶部添加一个shebang: https ://en.wikipedia.org/wiki/Shebang_(Unix ) 。 我看到你提到了cmd.exe所以我假设你需要这个在Windows上运行吗? 在这种情况下,你应该阅读https://docs.python.org/3/using/windows.html#shebang-lines
在unix主机上,我们需要做的第二件事是使用
chmod +x <filename>
将我们的文件设置为可执行chmod +x <filename>
。 我试图远离Windows,但我记得这与Windows无关。最后,您需要将脚本放在$ PATH变量引用的文件夹中
现在可以从cmd.exe或unix shell以SearchDir.py访问该脚本。 如果要省略“.py” - 部分,只需将文件重命名为“SearchDir”即可
Yes, it is possible (if I have understood you correctly. The question was a bit unclear)
The first thing you need to do is to add a shebang to the top of your script: https://en.wikipedia.org/wiki/Shebang_(Unix). I see you mentioned cmd.exe so I assume you need this to work on Windows? In that case you should read https://docs.python.org/3/using/windows.html#shebang-lines as well
On unix hosts, the second thing we need to do is set our file as executable with
chmod +x <filename>
. I try to stay away from Windows, but from what I remember this is not relevant on Windows.Last you need to place the script in a folder referenced by your $PATH-variable
The script will now be accessible as SearchDir.py from cmd.exe or a unix shell. If you want to omit the ".py"-part you simply rename the file to just "SearchDir"
相关问答
更多-
使用multiprocessing模块中的Pool对象。 然后可以使用例如Pool.map()来执行并行处理。 一个例子是我的markphotos脚本(见下文),其中一个函数被多次并行地调用到每个进程的图片上。 #! /usr/bin/env python # -*- coding: utf-8 -*- # Adds my copyright notice to photos. # # Author: R.F. Smith
# $Date: 2012-10-28 17: ... -
import os os.system("C:\path_to_python\python.exe C:\path_to_file\file.py") os.system()返回命令的退出值,所以如果你需要脚本的一些输出,这将不起作用。 import os os.system("C:\path_to_python\python.exe C:\path_to_file\file.py") os.system() returns the command's exit value so if you need ...
-
使用windows命令行运行python脚本并传递url参数(Using windows command line to run python script with passing of url argument)[2024-01-14]
我认为问题是你指定你的网址的方式,它需要在开始时有http://部分。 当我输入时它对我有用 python sys.py http://www.google.com/ 但失败了 python sys.py www.google.com (注意我使用linux和python 2.7,但我认为它可能是同样的问题) I think the problem is the way you specify your url, it needs to have the http:// part at the star ... -
如何运行一个python脚本,通过双击获取命令行参数(How to run a python script that takes command line arguments with a double click)[2022-05-31]
好吧,您可以使用os.system或subprocess进程模块调用shell进程。 os.system接受一个字符串并将其作为命令传递给shell。 import os os.system("ls -1") 而subprocess获取所有参数的列表(程序本身是第一个参数),并将其作为命令传递。 import subprocess # Simple command subprocess.call(['ls', '-1'], shell=True) 看到这些示例,很容易告诉您希望可执行程序调用其中一个( ... -
到目前为止,其他答案没有提到的一件事:两者之间的区别 ./program ... 和 program ... 不是你可以在你的程序内影响的东西。 这是因为默认情况下,Unixen在查找可执行文件时不搜索当前目录,只查找PATH上的目录。 你需要添加. 到PATH (不推荐,因为这是一个安全问题,我实际上并不确定它是否正常工作),将程序所在的目录添加到PATH ,或者将程序安装到已存在的目录中。 (例如,通过将它符号链接到/usr/local/bin/ 。我也将两者结合使用到我的实用程序中,将~/bin/ ...
-
使用命令行运行python脚本有什么好处?(What is the advantage of running python script using command line?)[2022-06-22]
人们为不同的目的使用不同的工具。 关于任何程序的界面的一个重要问题是谁是用户? 作为程序员,您将使用解释器来测试程序并检查错误。 通常,用户并不真正需要访问内部变量,因为他们没有使用解释器与应用程序/脚本交互。 例如,对于Python Web应用程序,通常会有一个main.py脚本将客户端HTTP请求重定向到适当的处理程序。 这些处理程序在客户端请求时自动执行python脚本。 然后将该输出显示给用户。 在Python Web应用程序中,除非您是开发人员试图消除程序中的错误,否则通常不关心访问像main.p ... -
是的,这是可能的(如果我理解正确的话。问题有点不清楚) 您需要做的第一件事是在脚本的顶部添加一个shebang: https ://en.wikipedia.org/wiki/Shebang_(Unix ) 。 我看到你提到了cmd.exe所以我假设你需要这个在Windows上运行吗? 在这种情况下,你应该阅读https://docs.python.org/3/using/windows.html#shebang-lines 在unix主机上,我们需要做的第二件事是使用chmod +x
... -
“独立的Django脚本” "Standalone Django scripts"
-
像这样设置您的Git仓库: bin/ xiber # Formerly index.py README.md setup.py 在setup.py文件中。 from distutils.core import setup # Typing this from memory (not tested). setup( name = 'Xiber', version = '0.1', scripts = ['bin/xiber'], # Other ...
-
Python 3的命令行(Command line from Python 3)[2023-12-29]
使用子进程模块。 这为您提供了最大的灵活性。 Use the subprocess module. That gives you the most flexibility.