I'm working with LexisNexis VisualFiles, whose scripting language doesn't allow for descriptive variable names - all it allows is "temporary fields" and "local fields" named TF01, TF02 or LF01, LF02 etc. Other data comes from "entities" so the descriptive name of any entity is "selectedentity.EN01" for instance.
我正在使用LexisNexis VisualFiles,其脚本语言不允许使用描述性变量名称 - 它允许的是“临时字段”和“本地字段”,名为TF01,TF02或LF01,LF02等。其他数据来自“实体”所以任何实体的描述性名称都是“selectedentity.EN01”。
This is horribly difficult to maintain, especially as a lot of what I'm editing wasn't commented when it was written. Particularly, if I find I need to use a new variable after writing a block of code, I find I'm just trying to invent variable numbers that I'm reasonably certain haven't been used anywhere else. Does anyone have any suggestions as to how to make code like this readable and maintainable, short of commenting each and every single line manually?
这非常难以维护,特别是因为我编辑的很多内容在编写时没有被评论过。特别是,如果我发现在编写代码块之后我需要使用一个新变量,我发现我只是想创建一些我确定在其他任何地方都没有使用的变量数。有没有人有任何建议,如何使代码像这样可读和可维护,没有手动评论每一行?
Edit: This is not ECL, this is the scripting language for Visualfiles. There are no resources I can find online, my only reference is the Help file that comes with the software. This is the sort of code I'm trying to decipher:
编辑:这不是ECL,这是Visualfiles的脚本语言。我没有可以在网上找到的资源,我唯一的参考是该软件附带的帮助文件。这是我试图破译的那种代码:
[&Assign LF12=""]
[&Assign LF13=""]
[&Assign LF10=ARAN_AAFOO.en02]
[&Assign LF11=ARAN_AAFOO.EN56]
[&Assign LF12=ARAN_AAFOO.ABAR_ARAN.DET03]
[&Assign LF13=ARAN_AAFOO.ABAR_ARAN.DET02]
[&If LF12<> "This" &And LF12 <> "That"]
[&If LF13=""]
[&Assign LF13="Something"]
[&Else]
[&Assign LF13=LF13]
[&EndIf]
[&If DET12="Yes"] **priority
[&Assign LF35="Top"]
[&Assign LF36="abnormal"]
[&Else]
[&Assign LF35="Bottom"]
[&Assign LF36="normal"]
[&EndIf]
Any variable can be any type, so I'm looking for a system that will help me keep organised and keep track of what I'm writing - if "comment everything" is the only solution that's fine too.
任何变量都可以是任何类型,所以我正在寻找一个能帮助我保持井井有条并跟踪我正在写的内容的系统 - 如果“评论所有内容”是唯一的解决方案,那也很好。
2 个解决方案
#1
Unfortunately there isn't an easy way with this. Maybe initialise the LF Fields at the top of the script with a comment next to each LF as to what it relates to. It's worth remembering that LF fields are Local to that script\document only and TF are for the duration of the session i.e. will go between scripts. It's worth trying to use LF fields where possible. You can also right click on a field, such as the DET12 one on your example and it will give you the field label.
不幸的是,这并不容易。也许可以在脚本顶部初始化LF字段,并在每个LF旁边添加注释以了解它与之相关的内容。值得记住的是,LF字段仅对该脚本\文档是本地的,而TF是在会话期间,即将在脚本之间进行。值得尝试尽可能使用LF字段。您也可以右键单击某个字段,例如示例中的DET12字段,它将为您提供字段标签。
It's all pretty messy and without prior knowledge of the DB fields and good commenting it can be a nightmare to maintain someone else's work.
这一切都非常混乱,如果没有DB领域的先验知识和良好的评论,维持别人的工作可能是一场噩梦。
#2
You could always use declared variables. Search for &DECLARE in the 'Help'. Here's an example they give [&Declare CurrentVATRate = "17.5"]
您总是可以使用声明的变量。在“帮助”中搜索&DECLARE。这是他们给出的一个例子[&Declare CurrentVATRate =“17.5”]
#1
Unfortunately there isn't an easy way with this. Maybe initialise the LF Fields at the top of the script with a comment next to each LF as to what it relates to. It's worth remembering that LF fields are Local to that script\document only and TF are for the duration of the session i.e. will go between scripts. It's worth trying to use LF fields where possible. You can also right click on a field, such as the DET12 one on your example and it will give you the field label.
不幸的是,这并不容易。也许可以在脚本顶部初始化LF字段,并在每个LF旁边添加注释以了解它与之相关的内容。值得记住的是,LF字段仅对该脚本\文档是本地的,而TF是在会话期间,即将在脚本之间进行。值得尝试尽可能使用LF字段。您也可以右键单击某个字段,例如示例中的DET12字段,它将为您提供字段标签。
It's all pretty messy and without prior knowledge of the DB fields and good commenting it can be a nightmare to maintain someone else's work.
这一切都非常混乱,如果没有DB领域的先验知识和良好的评论,维持别人的工作可能是一场噩梦。
#2
You could always use declared variables. Search for &DECLARE in the 'Help'. Here's an example they give [&Declare CurrentVATRate = "17.5"]
您总是可以使用声明的变量。在“帮助”中搜索&DECLARE。这是他们给出的一个例子[&Declare CurrentVATRate =“17.5”]