singlelineedit & datawindow/datastore - Sybase - sybase

I want to use singlelineedit as input.
So I've 4 input fields and a button.
I want to pass the inputs to datawindow/datastore when i click the button.
How do I write the code in the clicked event of the button?
I've created a datawindow namely dw_insert_into_table1 which built on top of a store procedure which is expecting 4 arguments.
Thank you.

long rows
rows = dw_insert_into_table1.retrieve( sle_input_1.text, &
sle_input_2.text, sle_input_3.text, sle_input_4.text )
Note that dw_insert_into_table1 must have been connected to a transaction object
with setTransobject or setTrans method before a call to the retrieve method, and be sure to pass input field value in the right order, the one you have defined your retrival arguments in the datawindow definition.

Related

Flurry-ParamDistribution comparison

I am sending event(event_payment_result) with more than one params and I am reviewing the parameters sent from Events > Parameter Distribution section. In this screen I can show only one parameter of event.
But I want to compare different params for this event. Are there any features for this comparison process? For example payment_type = Mastercard and is_succeed = TRUE
On the Parameter Trend dashboard, you can compare parameter values from different parameters over time. Use the context boxes at the top to choose the Event param names, in your example "payment_type" and "is_succeed", then the boxes just above the graph to select the values, "Mastercard" and "TRUE". You will then see the two values compared over time.

saving temporary data on matlab gui

I have made a GUI with Pushbutton and an Edit text.
The first step is to enter initial data at the Edit text and then click on the Pushbutton.
Once the Pushbutton is clicked, it gathers some info from API and then it does some long calculations and shows the results in a table.
However, if I change my initial Edit text, i still want to use the API that was the same in the first click.
Is there a way to save the data and use it for the next Pushbutton clicks to save calculation time and not gather info from API everytime?
*I had like to save that data only as long as the code opened, just for the case i will need more calculations. I dont want to save the data with save function and then have MAT files on that folder.
Thank you.
You can attach data to a specific GUI objects in different ways
1. Using UserData
The property UserData of an GUI object can store a variable of your choice (to store several variables just collect them in a struct, cell or array.
Use the object handle to get or set the data. For example, to set/get the UserData of a edit text box with tag edit1
set(handles.edit1, 'UserData', 2)
get(handles.edit1, 'UserData')
ans =
2
Note that within a callback you can write hObject to get the current handle.
2. Using application data
A very simular method is to store data to a GUI object using setappdata and thereby creating your own key-value map associated with that object/handle. The difference against the UserData method is that you can create several different key-value pairs (so the need to collect everything in a struct/cell/array isn't as imminent).
setappdata(handles.edit1, 'Foo', 1);
setappdata(handles.edit1, 'Bar', 3);
getappdata(handles.edit1)
ans =
Foo: 1
Bar: 3
getappdata(handles.edit1, 'Foo')
ans =
1
3. Using guidata
Another variant is to assign a single varible (like for UserData) to the main GUI figure rather than to a specific handle. This is done by using guidata. No key/name is used to set the data.
guidata(anyHandleInGUI, myData)
The first input is a the main figure handle or any of its children.
guidata(handles.edit1, 5)
guidata(handles.edit1)
ans =
5
Suppose your pushbutton has the tag pushbutton1. Since guidata locates the root parent (the figure handle) you can get the same data using its handle.
guidata(handles.pushbutton1)
ans =
5

Drop Down Parameter Not Returning a Value For a Query

I have a database set up which includes a query and a form, which are causing me problems. In the form, I have a drop down menu which allows you to select from a list of ID values (e.g. 1, 2, 3, ...). Once you have selected a value, you then click a button and it runs the query with a parameter of the ID number from the drop down ([Forms]![KitInfoRetrievalForm]![DropDown]).
The problem here though, is that when I select something from the drop down menu and click the button to run the query, it gives a pop up box asking for a value to substitute in for [Forms]![KitInfoRetrievalForm]![DropDown]. This leads me to believe that either the drop down menu is a null value for some reason or my pathing to it is incorrect.
This was working at one point and then stopped after a series of weird error messages from something else entirely (in the same Access project). Any help you can give me would be much appreciated.
I would recommend to replace reference to dropdown in query by function. It should eliminate this problem and also this is a workaround for old bug in Access, which exists in all recent versions: if the form/subform is in datasheet mode and you applied filter (quick filter thru user interface or using VBA), it stops reading variables with references to controls or just parameters and uses last used value.
I'm using this function for reading form/subform control value:
Public Function GetControlValue(strFormName As String, strControlName As String, Optional strSubFormControlName As Variant) As Variant
On Error Resume Next
If IsMissing(strSubFormControlName) Then
GetControlValue = Forms(strFormName).Controls(strControlName).Value
Else
GetControlValue = Forms(strFormName).Controls(strSubFormControlName).Form.Controls(strControlName).Value
End If
End Function
In your case replace [Forms]![KitInfoRetrievalForm]![DropDown] by
GetControlValue("KitInfoRetrievalForm","DropDown")

How to access to a Combo box value in Item Line on NetSuite?

In NETSUITE
is there any way to access to a value inside of a combo-box at the item line level?
I need to access to a value after inserting an item but all functions get me null value.
I have tried
nlapiGetCurrentLineItemValue
and
nlapiGetFieldValue
Both functions are getting me null values.
Thanks,
Pablo.
In general (for user event and client script) below code should work
nlapiGetLineItemValue(LINE_ITEM_TYPE, YOUR_FIELD_ID, LINE_NUMBER);
eg on SO to get the line item Id:
nlapiGetLineItemValue('item', 'item', 1);
PS: Syntax is independent of data type or field type
If you mean combo box as a mulitselect, and if you're trying to access via User Event Script, use:
nlapiGetLineItemValues(type, fldname, linenum);
Note the 's' in nlapiGetLineItemValues
If its just a standard field, nlapiGetLineItemValue(type, fldname, linenum) should work.
Which call to use depends on what event you are capturing.
For instance if you are trying to access the value in a post sourcing, field changed or line validate event of a client script you would use nlapiGetCurrentLineItemValue('item', 'fieldname');

Make variable name using loop and string in PowerBuilder

I am interested if it is possible to make variable name in PowerBuilder using a loop and a string. For example:
long ll_go
string lst_new
for ll_go = 1 to 8
lst_new = "text" + ll_go
lst_new.tag = 5500
next
So, it should give me variables text1, text2..,.,text8 and I would be able to assign values for them. Let me know if anybody succeeded, thanks in advance
Your description is lacking some term precision.
If you actually want to dynamically create new variables as "variable in a powerscript subroutine or function" this is simply not possible.
If instead you want to create dynamically some new controls statictext or textedit objects in a window or visual userobject this is possible:
use a local variable of the type of the new object you need to create, e.g. static text
make it a live object (instantiate) with create
set the object properties to whatever you need
"attach" the new object to its parent (either a window or a visual userobject - though any graphicobject is possible with using the win32api SetParent function) with the OpenUserObject() method. Note that you cannot simply add it directly to the parent's Control[] array.
you can also keep the object in your own array for later convenience access to the created objects instead of looping on the Control[] array
once the object is attached it its parent, you can reuse the local variable to create another one
Here is an example:
//put this in a button clicked() event on a window
//i_myedits is declared in instances variables as
//SingleLineEdit i_myedits[]
SingleLineEdit sle
int i
for i = 1 to 8
sle = create singlelineedit
sle.text = string(i)
sle.tag = "text_" + string(i)
sle.height = pixelstounits(20, ypixelstounits!)
sle.width = pixelstounits(100, xpixelstounits!)
parent.openuserobject(sle, pixelstounits(10, xpixelstounits!), pixelstounits(22 * i, ypixelstounits!))
i_myedits[i] = sle //keep our own reference
next
An exemple of values access:
//put that in another button clicked() event
SingleLineEdit sle
int i
string s_msg
for i = 1 to upperbound(i_myedits[])
sle = i_myedits[i]
if i > 1 then s_msg += "~r~n"
s_msg += "edit #" + string(i) + " (" + sle.tag + ") says '" + sle.text + "'"
next
messagebox("Edits values", s_msg)
As you can see, one practicality problem is that you cannot refer to these controls by constructing the control's name like "text"+2, instead you must access the my edits[] array or loop through the controls and test their .tag property if you set it to something specific.
I do not think that it is possible. Workaround could be an array maybe.
Br. Gábor
I'd see two ways to do this, but they aren't as easy as it seems that you were hoping:
1. Control Array
First method would be to go through the control arrays (on windows, tabs and user objects). I'd create a function that took the control name as a string, then another that overloaded the same function and took control name and an array of windowobject. The string-only method would just call the string/array method, passing the string through and adding the window.Control as the second parameter. The string/array method would go through the array, and for each element, get the ClassDefinition. Pull the name off of it, and parse it apart the way you want it to match the string parameter (e.g. for w_test`tab_first`tabpage_first`cb_here, do you want cb_here to match, or tab_first`tabpage_first`cb_here?). Deal with matches as appropriate. When you find a control of type tab or user object, call the string/array function again with the Control array from that object; deal with success/fail returns as appropriate.
2. DataWindow
What you're describing works extremely well with DataWindows, and their Describe() and Modify() functions. Since you pass these functions only a string, you can build not only the control names, but the values they're set to as you would build any string. In fact, you can build multiple Modify() strings together (delimited by a space) and make a single call to Modify(); this is not only faster, but reduces window flicker and visible activity.
Don't fall into the trap of thinking that, since your data isn't from a database, you can't use a DataWindow. Create an external DataWindow, and simply use it with one row inserted during the Constructor event.
As you might guess, I'd strongly favour the DataWindow approach. Not only is it going to perform better, but it's going to provide a lot more flexibility when you want to move on and tag more control types than just static text. (You'll have to do some type casting even with one control type, but if you want to get into multiples, you'll need to start a CHOOSE CASE to handle all your types.)
Good luck,
Terry
You can't create a variable name in a script because the variables have to be declared before you can use them. With PBNI it's possible to generate a name the way you describe and then get a reference to a variable of that name that already exists but I don't think that's what you want. If you want to keep track of additional properties for your controls, just inherit a new user object from whatever it is (sle, mle, etc.) and add the properties you want. Then you can place your user object on a window and use the properties. Another approach is to use the control's Tag property. It holds a string that you can put whatever you want in. PFC uses this technique. Terry's DataWindow solution is a good approach for storing arbitrary data.
Yes, and there are more than one way to skin a cat.
Sounds like you have several properties so I'd use an array of custom non visual user objects, or an array of structures. Otherwise you could probably use something from the .NET framework like a dictionary object or something like that, or a datawidnow using an external datasource, where you can refer to column names as col + ll_index.ToString().
SIMPLE Example:
Make custom NVO with following instance variables, plus getter/setter functions for each, name it n_single_field
// add the properties and recommend getter and setter functions
public string myTag
public string myText
public int myTabOrder
...
// To USE the NVO define an unbounded array
n_single_field fields[]
// to process the populated fields
integer li_x, li_max_fields
// loop through field 1 through max using array index for field number
li_max_fields = upperbound(fields)
for li_x = 1 to li_max_fields
fields[li_x].myTag = 'abc'
fields[li_x].myText = 'text for field number ' + li_x.ToString()
fields[li_x].myTabOrder = li_x * 10
next
Maybe I'm oversimplifying if so let me know, if there is a will there is always a way. ;)

Resources