Hiding/unhiding with input controls Webi Business Objects - sap

I have a variable Hide set to "true" so a table is automatically hidden. I would like to set this variable to "false" when an input control is chosen so the table is unhidden. Is there a way to do this?
Update:
I got the following code to work if specific input is hardcoded in code but I would like it to return false if ANY input control or report filter is selected
=If ReportFilter([x])="Joe" Then "false" Else "true"

I have solved my issue. I have set a dimension called "hide" to =If Match(ReportFilter([x]);"*;*")Then "true" Else "false" I then set the table to unhide when "hide" = false
What this does is once a filter is added with an input control, the filter will no longer include a ";" and the table will be unhidden

Related

How to get the VBA code auto select fields from Content Control drop down options

I wish to auto populate value from content control drop down option. I have four options in the drop down list and I want option 1 to be populated for Case Methodology.
While trying the below code is giving me:
VBA 6124 error- You can not edit it because it is protected,
Code:
Select Case oCC.Title
Case "Methodology"
oCC.Range.Text = " abc"
Case "Methodology2"
oCC.Range.Text = "NA"
I tried .LockContents=False but it is not working either. How can I write the code that can autoselect first value from the four options?
As this is a dropdown content control, Range.Text is read-only.
You have to use:
oCC.DropdownListEntries(2).Select
2 because usually the placeholder text is the first in your list.

Getting MS-Access form to save invisible combo boxes as a null or 0 value in query and table

I don't know that how I have built my form is necessarily the best way that I can do it, but it was the way that I could get it to work, at least partially. I have built a form in ms-access 2007 that uses vba to either hide or make available certain combo boxes. The first choice and the one on which the rest of the form is based is a yes/no option, being that either the customer requires outside services for their job or not. Once that is selected the user can then choose from the outside service options(Which are the combo boxes, either visible or no based on the first choice). So this is where the problem comes in, I have code written so that if the user chooses no in the very first box the rest of the boxes are made invisible. However if the user chooses yes they must then choose values, again yes or no to either retain or remove other options for the remainder of the form.
What I am looking to do is to make it so that when the user returns to the form what choices they made are still there. So if they chose no then the form would basically be blank and if they had said yes initially than that answer along with only the other choices they made would be available.
What I am currently using is a simple if-then statement to make the boxes either visible or not.
Private Sub Combo36_AfterUpdate()
If Combo36.Value = "No" Then Me.Combo18.Visible = False
If Combo36.Value = "Yes" Then Me.Combo18.Visible = True
If Combo36.Value = "No" Then Me.Combo20.Visible = False
If Combo36.Value = "Yes" Then Me.Combo20.Visible = True
End Sub
Obviously I am not experienced with access and have stumbling my way through it. I am sorry if any of what I have said above is confusing. If clarity is needed please let me know.
Well for a start, "Flase" should be updated to "False".
Instead of storing and then repopulating the selected values it might be easier to turn the visibility of the whole form true/false based on selection which would keep the last values the user selected.
For showing visibility of the controls try:
Private Sub Combo36_Change()
If Me.Combo36.Value = "No" Then
Me.Combo18.Visible = False
Me.Combo20.Visible = False
ElseIf Me.Combo36.Value = "Yes" Then
Me.Combo18.Visible = True
Me.Combo20.Visible = True
End If
End Sub
Your initial code is okay, to be able to have the form retain the choices then copy the code you have under the Combo36_AfterUpdate() event into the Private Sub Form_Current() event. This will do it.

Set value of checkbox to false

I need to set the value of a checkbox to false where the value of textbox1 is equal to item# in the table I have the checkbox in. I need to do this via a command button click. What is the simplest way to accomplish this?
You can put this code in your userform's CommandButton1_click() event and it should work.
If TextBoxName.Value = "Value of item you are comparing to" Then
CheckBoxName.Value = False
End If
You need to change certain things in this code like adding the name of the text box, name of the check box, and entering the value of the item you want to compare it to.

Hide row when a field is empty - Access VBA

So I have an expenditures subform in Access that has two columns: YearNo and Expenditures. I'm trying to set it up that when a yearno field is empty, the row is not visible but the value in expenditures isn't deleted from the backend table.
The code I'm trying to use is
Private Sub Form_Load()
If Me.YearNo = “” or IsNull(Me.YearNo) Then
Me.Amount.Visible = False
End Sub
However, the problem I'm encountering is that this makes the entire expenditures column hidden. I just want the row to not be visible. Any suggestions would be greatly appreciated.
What I wound up having to do was create a query attached to the table and set it to filter on load.
If the subform is based on a query in your db, you can modify the WHERE clause to filter out 0-length or Null [YearNo]s.
Or, you should be able to set the Filter property of the subform in Design view. If you look under Properties -> Data, there is the Filter property. If you enter
"[YearNo] <> '' AND [YearNo] IS NOT NULL"
then set the Filter On Load property to True, that should give you what you want. (Remove the code you already have on Form_Load as well.)

Cell in Devexpress Treelist is set to editable yet it won't let me edit

I am using a DevExpress (10.2) Treelist in my VB.Net project in Visual Studio 2008. I currently have a treelist with TreeList.OptionsBehavior.Editable = True. I have two columns were the first one is AllowEdit = False. The second column I am setting the AllowEdit and ReadOnly dynamically though the action FocusedNodeChanged.
Within the FocusedNodeChange subroutine I check if a specific value is in the row and if so I set it to be editable or non-editable. I am setting it to be editable with:
treeList.Columns("field_name").OptionsColumn.ReadOnly = False
treeList.Columns("field_name").OptionsColumn.AllowEdit = True
and setting it to readonly with:
treeList.Columns("field_name").OptionsColumn.ReadOnly = True
treeList.Columns("field_name").OptionsColumn.AllowEdit = False
This works to a degree. Right now if I go in the editable cell in the treelist the cursor appears and blinks so I know it is editable and if I go in the cell when the un-editable row is focused the cursor doesn't blink.
However even though the cursor blinks I am unable to type. When I click on keys (numbers and letters) on the keyboard nothing is written.
SOLVED
Simple solution. The stored procedure I was using to fetch the data into the table didn't contain the field for the particular column I was trying to make editable and not editable. This was because it was a new value that was insert/updated differently than normal. To fix this I fetched null and/or 0 and it worked fine.
The code you are using is not quite correct. The best solution is to handle the TreeList's ShowingEditor event and set the e.Cancel parameter accordingly. To determine the current cell, use the TreeList's FocusedColumn and FocusedNode properties.