WebBrowser Control - c#-2.0

Please help me.
<div id="id1">$97</div>
sometimes, id1 innerHTML value is changes.
My problems is:
If this values is change, i want to do somethings. How i can know this value is changes. I using webbrowser control and c#.

I don't have access to a Vb.NET converter but this "may" work I haven't tested it....I would get the element by it's id which is id1 and then get the id1 and save it to a text file or a database, etc.
Next you would recall id again to compare it against the previous inner text. If the number has changed then the app is to messagebox you the change if not...nothing happens or you could code a message box to say something to that effect.
But either way here is the code that I could think of under a button..
Dim count As Integer = WebBrowser1.Document.GetElementById("id1").InnerText
'Here is where you would call the old value maybe run this through a loop and save the value to a text file...then pull it back up when you need to check it to compare it to the current value being shown.
If count <> count Then
MessageBox.Show("count")
End If

Related

How to generate dynamic values in fitnesse

I have to insert incremental values in a column of the table using Fitnesse. The incremental value I'll get from a stored procedure which returns the last inserted value. So I have to increment the value and store it.
For example: I'll get a value from the stored procedure output. And I have to increment the value by 1 and insert into the table.
Any ideas?
Output from stored procedure is like : ACRDE0001 (PK)
Value to store in table : ACRDE0002, ACRDE0003, .....
Expected output
!|insert|table1|
|col1|col2|col3|
|ACRDE0001|abc|def|
|ACRDE0002|abc|def|
|ACRDE0003|abc|def|
.
.
.
.
As far as I'm aware the only way to change (e.g. increment) a value you get during your test is by writing some code in a fixture. There is a pull request to allow more dynamic Slim expression directly in the wiki, but that has not been merged (let alone released) yet.
Your questions suggests that the value is something you get from a database and that you then want to send back the generated/incremented value with new records you insert. In that case I wonder whether the increment is actually that useful to actually have in your wiki (your test case is not about the generated values, is it?).
Maybe your fixture could just retrieve the initial value (or have it supplied as constructor value) and the fixture could generate the a new value for each row and send them to the database.

How can i delete the value of a column in powerbuilder?

I have a datawindow with 3 selection criteria. This selection criteria are 3 columns. If the user writes something in one of them, than he can't use the others. If he tries to do that a message aware the user that he can use only one criteria. The problem is that after he deletes or cuts what he wrote before and he tries to write something in another column, the message still pop-up. I think that the buffer still contain the last value. How can i reset it?
I guess you have to nullify the 'deleted' column. I would do it that way: in the 'ItemChanged', post:
if dwo.name = 'yourcolumn' and data = '' then
SetNull(ls_null)
post dw_selection.Setitem(row, dwo.name, ls_null)
end if
This, of course, needs to be adapted to suit your needs.
Check the "itemchanged" event of the datawindow with the returned values:
Return value
Set the return code to affect the outcome of the event:
0 (Default) Accept the data value
1 Reject the data value and do not allow focus to change
2 Reject the data value but allow the focus to change

How to change format / treat missing values in SPSS

I'm using SPSS modeler and I have a variable that the software recognizes as numeric. So the missing values are $null$. I want that the missing values of the variable are selectionable with '', as character.
So I would: or trasform the format of the variable from numeric to character or change only the missing values from $null$ to ''.
How can I fix?
thanks in advance
The best way to select null values in a numeric field is to use the #NULL() function from the Blanks and Null section of the Expression Builder.
For example, if you wanted to keep only the null values so that you could inspect them, you might use a Select node. Leave the radio button set as Include. Press the Expression Builder (calculator) button. Change the filter in the drop menu on the left side from General Functions to show Blanks and Null (press B 2 or 3 times). Double-click on #NULL(ITEM). Go to the right side and double-click on your numeric field name. Put a Table node at the end and run it.
Using Select #NULL in IBM SPSS Modeler
Another way to view just the null rows is to enter the #NULL(varname) function into the "Highlight records where" section of the Table dialog box.
"Highlight records where" dialog
When you run the table, any row that is true for this condition will be shown in red.
If you really need the variable to be a string, then use a Compute node to create a copy of this field under a new name and use the to_string() function in the Conversion section of the Expression Builder to change the type of the variable. Now you will be able to use the the Select node to grab "" as the missing value. Or you could use the Filler node to replace the column, but then you would not be able to compare before and after.
The dialog examples shown in this answer use this sample stream that is installed with your IBM SPSS Modeler software:
C:\Program Files\IBM\SPSS\Modeler\18.0\Demos\streams\featureselection.str
The easiest way to do it it's using the Fill node with the configurations:
A) FIELD
B) Condition = #NULL(#FIELD)
C) Replace by = ' '
This node will replace all $null$ for ' ' at the same variable chosen in option a.
I don't think you can customize how you visualize $nulls. (I know it's possible in SQL db though)
So I'd suggest that you work with the numbers and when you want to visualize or export the results, then turn the field to a string one then replace nulls:
Filled node > to_string(#FIELD)
Filler node > blank and nulls > #FIELD = ''

Recognize the type of the parameters of a user defined sql to be used in a Delphi TQuery at runtime

I'm writing a delphi(7 ver) application and in some place I want to execute parameterized queries (for BDE and Paradox) which will be loaded at runtime into a TQuery by the user. These queries will be stored in text files (one text file for one query). The application then, will construct for any parameter of the query, one input control (Tedit) in order to be able to accept values by the user. Also there will be a button for the execution of query. My question is how can I recognize the datatype of the query's parameter? Is there a way to get this type without of cause to be included in some way in the text file containing the query?
Create a second query from the first, but modify its where clause to ensure no rows.
SELECT * FROM MYTABLE WHERE PKFIELD IS NULL
Name your parameters so that you can establish their datatypes from the fieldtypes of this second query.
I realise this only works for relatively simple cases, but it should get you some of the way.
the advantage of using a parameter is that you don't need to know its data type.
Use the string value from the tedit
"select * from mytable where myfield = :param1"
"parambyname('param1').asstring := edit1.text"
I've made this with MySQL database. you must define some parameters, Exemple:
SELECT * FROM MyTable WHERE MyField=[ANNEE];
in this case, i have an other table, called balise, that look like this
"ID" "BALISE" "CAPTION" "DEFAULT_VALUE" "CNDT" "COMPOSANT"
"1" "ANNEE" "Année" "2014" "Properties.MaxValue=2014||Properties.MinValue=2007" 1;
in runtime, this mean that:
Make in my Panel, a TLablel that have caption Année
Make in the same line an other component type 1 (That mean in my case TcxSpinEdit), this component have défault value 2014, have Two properties Max Value=2014 and Min Value=2007, (I use RTTI to modifie this value of parameters, in Delphi ver7, use TypeInfo).
An Other Button with function called Actualise, this function have Original query, must browse an array of TBalise that i have created, take the value (In my case, take TcxSpinEdit(MyObject).Value), and replace it in the copy of my query (AnsiReplaceStr(Requete, '[ANNEE]', MyValue)), so i have the final query to execute it.
I have module in complete projet, worked with this methode, and it workk fine.

How to manipulate the contents of a DB Grid before display?

I have a column in a DB table which stores pressure. The pressure is always stored as PSI and can be converted to BAR by diving by 14.5.
The user can toggle display of PSI/BAR with a Radio Group.
I was using a TStringGrid and am converting to a TDbGrid - which is quite new to me.
When the user toggles PSI/BAR, how to I update the display in my DB grid? (I imagine that I just execute it's query again? or Call query.Refresh()?) But how do I do the conversion?
Possibly a stored procedure, although that seems like overkill and stored procedurs are also new to me...
By changing the SELECT statement of my query? But how would I do that? SELECT pressure / 14.5 FROM measurements? Or how?
Or is there an OnBeforeXXX() which I can code? Or OnGetDisplayText() or some such?
I am sure thta this is very basic, but until now I have just been displaying unmanipulated data and now I need a conversion function. Google didn'ty help, but I probably didn't know what to ask for.
I also want to change the text of the column title, toggling between "Presure (PSI)" and "pressure (BAR)".
Thanks in advance for any help.
Code a OnGetText event handler for the pressure field like this:
type
TPressureMU = (pmuPSI, pmuBAR);
const
PSIToBarFactor = 1/14.5;
procedure TdmData.qMeasurementsPressureGetText(Sender: TField; var Text: string;
DisplayText: Boolean);
begin
case PressureMU of
pmuPSI: Text := FloatToStr(Sender.AsFloat); //Already PSI
pmuBAR: Text := FloatToStr(Sender.AsFloat * PSIToBarFactor); //ConvertingToBAR
end
end;
I'm using a property PressureMU of the declared enumeration to control if the pressure is shown in PSI or BAR measurement unit.
This way, when the user changes the selection, you just adjust the value of that property.
If you use persistent fields, you can link the event handler directly to you field using the object inspector, and if not, you can do it by code like this:
begin
qMeasurements.FieldByName('Pressure').OnGetText := qMeasurementsPressureGetText;
end;
where qMeasurementsPressureGetText is the name of the method.
Create persistent fields (right-click the query, and choose Add Fields to create fields at design time that are stored in the .dfm). Right-click the query, and add a new field. Make it a calculated field, and in the OnCalcFields event of the query do the conversion from PSI to BAR.
Now when the user toggles the display, you just display either the PSI or BAR column by setting the Column.FieldName, setting it to the actual PSI column or tne newly calculated BAR column.
Of course, if you're not using persistent fields, you can do it all in the query. Simply add a new column in your SQL statement that contains the result of the conversion, and you can still just change the Column.FieldName at runtime to toggle which value is being displayed.

Resources