从“复选框组值提示”获取值时出现问题

发布于 2024-08-25 23:48:01 字数 484 浏览 11 评论 0原文

我有 ui:checkbox 组的值提示
参数:p_IsLastMonth
名称:Prompt_IsLastMonth
项目数量:1;使用值:是,显示值:上个月?

和两个日期提示。

每当选中该复选框时,UseValue“Yes”就会传递给参数“p_IsLastMonth”。但只要该复选框保持原样,就会导致错误。

Element 'selectOptions' is not valid for content model: 'All(style,defaultSelections,conditionalStyles,conditionalRender,XMLAttributes)' 

我也尝试给出默认值。但默认值必须在集合中。但我只想显示一个复选框。

我尝试使用 html 复选框。但我无法通过 javascript 将值“是或否”发送到参数,因为完成按钮会覆盖该值。

有什么帮助吗?

I've value prompt with ui:checkbox group
parameter: p_IsLastMonth
Name: Prompt_IsLastMonth
ItemCount: 1; UseValue:Yes, DisplayValue: LastMonth?

and two Date Prompts.

Whenever the checkbox is checked, the UseValue 'Yes' is passed to the parameter 'p_IsLastMonth'. But whenever the checkbox is left as it is, it results in an error.

Element 'selectOptions' is not valid for content model: 'All(style,defaultSelections,conditionalStyles,conditionalRender,XMLAttributes)' 

I also tried giving a default value. But the default value has to be in the collection. But i want only one checkbox to be displayed.

I tried with html checkbox. But i'm not able to send the value 'either yes or no' to the parameter through javascript because however the finish button overrides the value.

Any help?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

烈酒灼喉 2024-09-01 23:48:01

您可以通过两种方式使用参数:

  1. 评估参数值
  2. 根据参数值评估表达式。

无论哪种方式,你的参数都有一些值,并且没有值是一种值。你需要以某种方式迎合空值。例如:

 If (?Parameter? <>'') then ([Selection Criteria] = 'True') Else (1=1) 

或者

 ([Selection Criteria] = ?Parameter?) OR ?Parameter? = ''

还有其他使用参数的方法。您应该选择一种更适合您所遵循的情况和编码实践的方法。

您可以使用可选的复选框或文本项。在 Cognos 10 中,我在复选框组下找到“取消选择”选项。

There are 2 ways you can use Parameters:

  1. Evaluate Parameter value
  2. Evaluate expression against Parameter value.

Either way your Parameter has some value, and no value is a kind of value. And you need to cater for empty value in some way. Eg:

 If (?Parameter? <>'') then ([Selection Criteria] = 'True') Else (1=1) 

OR

 ([Selection Criteria] = ?Parameter?) OR ?Parameter? = ''

There other ways of using parameters too. You should choose one that better suits situation and coding practices you are following.

You can use optional checkbox or text item. In Cognos 10 I get "Deselect" option under checkbox group.

冷弦 2024-09-01 23:48:01

不幸的是,我认为仅用一个复选框无法完成您想要做的事情。未选择值提示并仍然提交提示页面的唯一方法是将其设置为“可选”,这意味着不会传递任何值。一种选择是使用两个复选框并使它们成为“必需”,以便必须选择“是”或“否”(但这可能会导致两者都被选中,这不好),或者最好使用单选列表有两个值,默认为“yes”。可能有一个 JavaScript 答案,但我尽量避免这样做,因为它有时会让您面临版本升级问题。使用广播列表是最简单的选择。

Unfortunately, I don't think you can accomplish what you want to do with only one checkbox. The only way you can leave a value prompt unselected and still submit the prompt page is to make it "optional", which means no value will be passed. An option is to use two check boxes and make them "required" so that either "yes" or "no" must be selected (but this can result in both being selected, which isn't good), or preferably use a radio list with two values and "yes" as the default. There may be a javascript answer to this, but I try to avoid that as much as possible since it sometimes leaves you open to version upgrade issues. Using a radio list is your easiest option.

若相惜即相离 2024-09-01 23:48:01

好吧,这里有一些有用的东西。我已经使用 Cognos 进行了高级记分卡和仪表板多年,并且 Javascript 可以工作:

  1. 创建一个真正的 cognos 参数,其中包含您需要的两个选项“是”/“否”,默认为“否”。也许将它们放在远离报表/参数画布主要区域的 html 表中。配置参数后,您可以将大小设置为您想要的小值,然后通过将visible属性设置为no来使表格/复选框不可见。基本上用户不会看到这些参数。不要执行 box-type = non ,否则参数甚至不会生成。您也可以等待隐藏它们,直到我们开始执行第 3 步(使故障排除变得更容易)。

  2. 然后创建一个 HTML 参数,用户将使用该参数以您希望用户看到的样式进行交互,并使用 javascript onchange 事件通过 DOM 模型查找真正的隐藏参数来操作它。您可以通过使用具有唯一名称/ID 的 HTML 标记包围隐藏参数并从那里引用子项来更容易地找到它。

  3. 由于您的 cognos 参数是不可见的,您甚至可能不需要使用复选框...您可以简单地使用一个存储“是/否”的隐藏文本框。这将使您的 JavaScript 编码得到简化,直到您习惯为止。

  4. 此外,当在 Cognos 上使用 javascript 进行编程时,我发现使用警报将对象的 insidehtml 回显到屏幕,同时进行故障排除非常方便。

    另外,当

* 如果我没记错的话,还有另一种不太令人印象深刻的方法。
1. 保留原始的 cognos 样式复选框,并创建另一个始终默认为“-NO-”并隐藏在画布上的 cognos 提示。
2. 在用于评估参数的表达式中,将评估两个参数的串联值,您可以根据这些值采取逻辑操作。因此,如果连接的结果是“-否-”,那么您就知道原始参数未被选择并使用“否”。等等...我相信在表达式编辑器中正确评估它可能存在细微差别,但我之前也有过这个工作。 *
因此,在您的情况下,如果连接结果前 3 个字符 =“是”,则为“是”,否则为否。

Well here is something that will work. I've done advanced scorecarding and dashboarding for years with Cognos and Javascript will work:

  1. Create a real cognos parameter that has both choices you need Yes/No with no being the default. Put them perhaps in a html table somewhere off the main real-estate of the report/param canvas. Once you have the param configed you can make the size as small as you want and then make the table/checkbox invisible by turning the visible property to no. Basically the users won't see these params. Don't do box-type = non or the parameter won't even get generated. You could also wait on hidding them until we get step 3 working(Make it easier to troubleshoot).

  2. Then create a HTML parameter that the user will use to interact with in the style that you want the users to see, and use javascript onchange events to manipulate the real hidden parameter by finding it via DOM model. You can make finding it easier by perhaps surrounding the hidden params with an HTML tag that has a unique name/ID and referencing the child items from there.

  3. Since your cognos parameter is invisible you may not even need to use a check box... you could simply use a hidden text box that has stores Yes/No. This will make your coding simplified on the javascript until you get used to it.

  4. Also When programming with javascript on Cognos i find using alert to echo a object's innerhtml to screen while troubleshooting to be very handy.

* One other less impressive approach if i remember right as well..
1. Leave your original cognos style checkbox alone and create another cognos prompt that is always defaulted to "-NO-" and hidden on the canvas.
2. In the expressions used to evaluate the parameters the would evaulate the concatenation values of both params and you could take logical action based on those values. So if the concatted results were "-No-" then you know the original paramater was not selected and to use "No". etc... I believe there could be a nuance to getting this to evaluate correctly in the expression editors but i have got this owrking before as well. *
So i your case if the concatted results first 3 characters = "Yes" the "Yes" otherwise no.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文