I am updating a variable through text field and trying to print it in the console but it is printing previous value instead of updated value - install4j

I am updating a variable in the text field and trying to print it in the console but it is printing the previous value instead of updated value
String symbolicName =(String)context.getVariable("symbolic.domain.name");
console.println(symbolicName);// it is printing old value insted of updated value
I am expecting updated value it is printing old value.

The variable is updated when the user clicks on the "Next" button. To update all bound variables on the form before that, execute
formEnvironment.saveFormComponents();

Related

Solution to Failure to Obtain an Input Value

When I entered a value in the input box and submitted it, the mandatory item verification failed, and the system displayed a message indicating that a parameter was empty and instructed me to enter a value. The code for obtaining the input value is as follows:
(see the solution in column C)
can you give me some advice about it?
The possible cause is that the method for obtaining the value is incorrect. As a result, the value in the input box cannot be obtained.
Use the onchange event to assign a value to the model and obtain the value of the input box. The method is as follows:
Initialize the model.
data:{
accountValue:''
}
Bind an event to the input box.
<input #change="getAccountValue" value="{{accountValue}}"></input>
Assign a value.
getAccountValue: function(e) {
this.accountValue = e.value // Here, e.value instead of e.target.attr.value is used.
}
Refer to the official document instead of generating a JavaScript object for coding. A JavaScript object may lead to compatibility issues.
Currently, the data binding mode of the quick app is unidirectional.
The value entered in the input box does not change the value of accountValue in data.
If the value of the input box is changed by setting this.accountValue to xxx, the onchange event of the input will not be triggered.
In this.accountValue = xxx format, if the value of accountValue before and after the change is the same, the page will not be re-rendered.

MS Access: Enter a specific text in a form using command button from another form

I would like to ask for your help on the following issue in MS Access.
I had created a form "CustomerListF", filled with command buttons for each client. For each button, I had created the following code:
Private Sub cmd_outlets_ABC_Click()
DoCmd.OpenForm "OrderFormF"
Forms!OrderFormF!Outlets = "ABC"
End Sub
The button would then open another form "OrderFormF" and enter "ABC" in the textbox named "Outlets". However, I realized the second line of code (Forms!OrderFormF!Outlets = "ABC") would always create a phantom record in my subform, which is located in "OrderFormF", and this record would travel to other clients' forms. This phantom record is usually created when the commandbutton is clicked twice (double clicks or subsequent clicks). It is a headache when the record starts to shift around.
enter image description here
I would like to seek your advice for vba code to edit the second line of code.
Thank you.
This approach for filling the field in opened form is not good. OrderFormF initialization and second line of your code with assigning value to the field may be executed in different sequence, they are not synchronized.
In order to avoid this, you should pass the argument to OrderFormF by another way. I would recommend to use OpenArgs parameter:
DoCmd.OpenForm "OrderFormF",,,,,,"ABC"
And then in Load event of OrderFormF assign the value to textbox:
Me.Outlets = Me.OpenArgs
In this case the "ABC" value will be assigned to first row in the form or to new record, if form is empty. Before assigning you can select the row if you need to assign value not to the first row. Also this way will protect you against double click on button, Load event executed only once during first form opening

Remove quotes from string

I have a MATLAB GUI that shows all variable names in the base workspace in a popupmenu. The user can then choose a variable. This variable is then passed into a function. My problem is that I cannot find a way to grab the variable's value from the popupmenu. I am getting a cell, which I convert into a string.
data = get(handles.popupmenu1,'String');
data = data{1};
The problem is that if the variable is named n, then this will return 'n', with quotes, when I need it to return it without quotes. So, when I try to get the value, it does not work.
data = evalin('base','data');
How do I remove the quotes from the string?
It's probably not the most efficient way, especially if you have a lot of variables in the popup menu, but could you store your variables in the handles structure of the GUI, and when the user selects a variable name from the popup menu it triggers a switch/case scenario in which you use strcmp, for example, to evaluate what the variable is and thus get its value form the handles structure?
Or maybe create some kind of lookup table in the UserData property of the popup menu, so that each 'String' displayed in the popup menu can be related to the corresponding variable, after which you get its value and can then pass to other callbacks?
I can't test it with a simple script right now and that's only ideas; I'll check tomorrow unless someone comes up with an idea in the meantime!
Ok, you can try this:
data = get(handles.popupmenu1,'Value');
Use 'Value' instead of 'String'.

How can I increase a form field every time the document is printed?

I know someone which has a single-page MS Word document for receipts.
One headline includes RECEIPT #<number>. At the moment he looks up which number was on the last printed receipt and adjust the receipt number manually to be that number plus one before he prints out a single copy of the document.
I thought this could be improved by using a form field holding the number which is then increased by one every time the document is printed. I didn't found anything supported by MS Word out-of-the-box, but I think that it can be done using VBA. It's years ago that I had to program in this language and I never did anything with form fields in Word and print events.
Can anyone point me in the right direction with some sample code which can do this? Automatic saving of the document after adjusting the number would be welcome, too.
Word lets one control the DocumentBeforePrint event, which I think would give you the result you need. After a Text Form Field has been added to the document itself, add this code to the ThisDocument VBA Declarations section:
Option Explicit
Private WithEvents app As Application
Then edit the Document_Open() sub to read:
Private Sub Document_Open()
Set app = Application
ActiveDocument.Variables("ReceiptNumber").Value = ActiveDocument.FormFields(1).Result
End Sub
Finally, create the DocumentBeforePrint sub with the following code:
Private Sub app_DocumentBeforePrint(ByVal Doc As Document, Cancel As Boolean)
Dialogs(wdDialogFilePrint).Show
With ActiveDocument
.Variables("ReceiptNumber").Value = .Variables("ReceiptNumber").Value + 1
.FormFields(1).Result = .Variables("ReceiptNumber").Value
.Save
End With
Cancel = True
End Sub
This code will launch the Print dialog box and, after printing, increment the counter and Save the document. The Cancel = True line cancels the standard Print dialog box, so that the code does not try to print the document twice. (One can also increment the counter after printing by removing Dialogs(wdDialogFilePrint).Show and Cancel = True.)
I think it's worth mentioning that once the code is in place, set this process up by double-clicking in the document's form field (the one that will contain the receipt number) and select "Number" for the field type and enter the first receipt number that needs to be printed as the "Default number."
Once the form field's defaults are entered, save the document manually and then close it. Now each time it is opened, the contents of the form field will be assigned to the variable and the DocumentBeforePrint event will increment the field upon each printing of the document. Should the user need to reset the field (due to printer jam or some other unforeseen event), he should double-click the field, change the default value, click OK in the dialog box, save the document, and close it (to clear out the previously assigned value for the counter's variable). As before, opening the document will make it ready for printing and incrementing. Hope this helps.

Perl/Tk : Getting the selected value of option menu

I am developing one interface in Perl/Tk.
In that I am using one optionmenu to list the names of the users.
And while selecting the user from optionmenu it should display corresponding date of birth of the employee.
And I should be able to update the date of birth of the selected user.
I have written the following code.
$dob_label = $form_name -> Label(-text=>"BirthDay")->place(-x=>150,-y=>200);
$dob=$form_name->DateEntry(-width=>11,-parsecmd=>\&parse,-formatcmd=>\&format)->place(-x=>250,-y=>200);
$ename = $form_name->Optionmenu(-variable=>\$select_value,-options => [#names],
-command=>sub {&get_id_date($hash_ref,$eid,$dob,$_[-1])})->place(-x=>250, -y=>100);
$post_button=$form_name->Button(-text=>"Add",-command=>[\&Add_Birthday,$select_value,$dob,"edit"])->place(-x=>250,-y=>275);
The function get_id_date is used to get the id and dob of employee using the name of the employee.
It is returning the correct id and dob.
Then I edited the dob of the employee.
And I am calling Add_Birthday function to save the changes into database.
But what is the problem in this is,the variable $select_value is always having the value of first name in the optionmenu.
Actually it should have the value of the last selected item in the optionmenu.
So what is the problem in this code,
Please give the solution for this also.
Thanks in advance.
When you create the Button, you are passing the current value of $select_value to the button/command set up. By the time you press the button, the old value of $select_value has already been evaluated and set in the command argument list. You need to make your command a closure, so that $select_value is not evaluated until the button is pressed, e.g.:
-command => sub { Add_Birthday($select_value, "dob", $edit) }
For completeness, I should also mention that another way of doing this is to pass in references:
-command => [\&Add_Birthday, \$select_value, "dob", \$edit]
But that requires rewriting the function to accommodate the references in the argument list.