Infopath 2007 - How do I perform data validation on the current view ONLY? - validation

I have an infopath 2007 form that I am developing which uses 3 different views.
The 3 different views are basically the same form, but have different text boxes shown, depending upon what button the user selects.
I run into a problem where 'view 1' has some form validation, but the user has selected 'view 2' and submits it. The form validation on 'view 1' is triggered, and the user cannot submit the form.
How can I ignore the form validation on 'view 1' if the user is currently submitting 'view 2'?

Rather than tick the standard "this field cannot be blank" checkbox (for example), you need to use the Data Validation rules instead. Lets say you have two views with a textbox in each that cannot be blank, but you want to only enforce the current view. Here's the structure of the form:
fields:
currentView (number) (default = 1)
text1 (text)
text2 (text)
button1
button2
view 1 ( default)
text1 - rule: if (currentView = 1 AND text1 is blank) show "cannot be blank"
button1 - action: set a fields value (currentView = 2); switch views (to 2)
view 2:
text2 - rule: if (currentView = 2 AND text2 is blank) show "cannot be blank"
button2 - action: set a fields value (currentView = 1); switch views (to 1)
Make sense?
Oisin

Related

Setting date value in an Interactive grid based on a page item

I am trying to set a interactive grid column value (which is a date) based on a page item (which is also a date). I have already tried defaulting and using dynamic action set value (jquery seletor) to set item value to the interactive grid column but it does not work how I want it to work.
I have a page item called "P_DEF_DATE" and I want to set a date column in the interactive grid to this value but I want when I change the value in the page item and I click add row on the interactive grid, it must always use whatever value I have in the page item. For example:
P_DEF_DATE = 12-JAN-2021
when I click on add row in the interactive grid, my date column must equal to P_DEF_DATE and i add a few rows based on that date but then i change the date of P_DEF_DATE to:
P_DEF_DATE = 28-JAN-2021
now I want when I click on add row in the interactive grid, I it must show this new date from the page item in the date column in the interactive grid, keeping in mind the page does not refresh and I have rows with the date 12-JAN-2021.
Thank you in advance!
I implemented same few days ago. Following is what I did.
Create Dynamic Action on Row Initialization Event, set Region to your IG
Set True Action to Execute JavaScript Code
Use code
var model = this.data.model,
rec = this.data.record,
meta = model.getRecordMetadata(this.data.recordId);
if ( meta.inserted ) {
model.setValue(rec,"COLUMN_NAME", $v("P_DEF_DATE"));
}
Replace JOB with your column name and P_DEF_DATE with you Item name
More details Here
Also, out of curiosity, why there is no number like P1, P2 in your item name ??

Tableau: How to restrict a dropdown filter to fields that start with "2021*" (a fiscal week field that adds a new field weekly)?

I need an automatic way to have new fiscal weeks (a string that looks like yyyyww) added to my dropdown filter. It's necessary that it's a dropdown unfortunately. Can I just filter out all values that don't start with "2021*" in this particular table? I use those other values in other parts of my dashboard, so I can't filter them out of my data completely.
Create a calculation called DateDisplay as follows:
IF STARTSWITH((STR([Period])),'2021') = TRUE then 'Display'
END
Add the new DateDisplay field to the Filters Shelf and uncheck NULL
Select 'Show Filter' for the string date field
On the drop down menu (down arrow on the right) for the filter which is now showing, select the options 'Only Relevant Values'

making my tabular form dynamic

I have a checkbox on a tabular form. I need to be able to hide it if the submit date is not filled in and show it when a date is there. Once the checkbox has been clicked, I need to update another field based on the checkbox being clicked or when I hit the update button. is this possible on a Oracle Apex tabular form in version 4.2?
You can create dynamic actions on tabular form fields, but you need to know some Javascript / jQuery / DOM stuff as it can't be done declaratively as it can with page items.
As an example, I created a simple tabular form on the EMP table:
Using the browser's Inspect Element tool I can see that the HTML for the Ename field on row 3 looks like this:
<input type="text" name="f03" size="12" maxlength="2000" value="Ben Dev"
class="u-TF-item u-TF-item--text " id="f03_0003" autocomplete="off">
The relevant bits to note are the name "f03" and the ID "f03_0003". For all tabular form fields, the name indicates the column, and is the same for all fields in that column. The ID is made up of the name plus a string to represent the row - in this case "_0003" to represent row 3.
Similarly, the Hiredate fields are all named "f004" and have IDs like "f04_0003".
Armed with this information we can write a dynamic action. For example, let's say that whenever Ename is empty then Hiredate should be hidden, otherwise shown. In pseudo-code:
whenever an element with name "f03" is changed, the element with name "f04" on the same row should be hidden or shown.
So we can create a synamic action with a When condition like this:
Event = Change
Selection type = jQuery selector
jQuery selector = input[name="f03"]
i.e. whenever an input whose name is "f03" is changed, fire this action.
The action performed will have to be "Execute Javascript code", and the code could be:
// Get the ID of this item e.g. f03_0004
var this_id = $(this.triggeringElement).attr('id');
// Derive the ID of the corresponding Hiredate item e.g. f04_0004
var that_id = 'f04'+this_id.substr(3);
if ($(this.triggeringElement).val() == "") {
// Ename is empty so hide Hiredate
$('#'+that_id).closest('span').hide();
} else {
// Ename is not empty so show Hiredate
$('#'+that_id).closest('span').show();
}
Because Hiredate is a date picker, I needed to hide/show both the field itself and its date picker icon. I chose to do this by hiding/showing the span that contains them both. This code could have been written in many different ways.
You could apply similar techniques to achieve your aims, but as you can see it isn't trivially easy.

Counting a field value response weekly basis in Lotus Notes

I have radio button field in a form whose value can be 1 or 2 or 3. I have a made a view out of this form and there one column will contain the value of this radio button field . Whenever a customer submits the form, a new document will appear in the view. A customer can submit the form many times with different value of this radio button. Is it possible to know how many times a particular customer selected the value 1?
Yes, you can create a view where the first column is your customer name and the second column is their response. Both columns should be "categorized" meaning they'll group the like values.
For each column you can set the formula to include the number of documents within the group. For example:
CustomerName + " (" + #DocChildren + ")"
will show you "ABC Company (12)" if ABC had 12 responses.

Microsoft Word 2013 - form field - based on dropdown value show / hide fields

I've got several fields in my document . Based on a dropdown-field I want to show / hide several other fields.
Told in another way. I have a dropdown that have these options "Custom", "As sunday", "Closed". If the dropdown value is "custom" then I should show the field "time". All the other options it should just print the dropdown value.
In my word file, it's like this
[dropdown] [time]
Ex: dropdown value is "custom", the field should be like below (only showing time):
0800 - 1600
Ex: dropdown value is "closed", the field should be like below (only showing the dropdown value):
closed
I've tried to use a formula like this:
{ IF "{dropdown}" = "custom", "", {dropdown} }
I think the problem is that "dropdown" field are changing when a user picks a value from the dropdown. is there a way to insert the value from the dropdown.. like REF "{dropdown}"
If you still don't understand what I'm trying to get.. told in the third way:
if the dropdown shows "Custom" I only want to display the time when the store is open.
if the dropdown shows anything else but custom it should just print the value of the dropdown, and leave the time "blank"
Assuming that you are using legacy form fields, only trying to change what is displayed, not what fields the user gets to enter (it's ambiguous as far as #"time" is concerned) then you need something like this:
{ IF "{ dropdownfieldname }" = "custom" "{ TIME }" "{ dropdownfieldname }" }
where
- all the {} are the special field code brace pairs that you can insert using ctrl-F9 on Windows Word
- dropdownfieldname is the name of the drop down field (set in its properties). It is possible to relocate this bookmark name in which case you will need to rename the dropdown a couple of times at develeopment time to re-impose it
- "custom" must be "custom" as written in the dropdown's list of values. i.e. if it's "Custom", use "Custom". Or use
{ IF "{ dropdownfieldname \*upper }" = "CUSTOM" "{ TIME }" "{ dropdownfieldname }" }
{ TIME } is the built-in time field. If you really want a reference to another form field value, that happens to have bookmark "time", you will probably need "{ ref time }" instead. If your field is actually called "timefield", use "{ timefield }"
If you are using Content controls, IMO the best way to do it is actually to create a custom XML part, link the dropdown result to an element in the part, link a plain text content control to the same element, and literally insert that control where I have put { dropdownfieldname }. Ditto for { timefieldm }

Resources