Value of type string cannot be converted in system.timespan - timespan

I am creating a system where the user enter the time from and time to in a text box inside a repeater, and when I try to assign the textbox value to a local variable it gives me an error
Value of type string cannot be converted in system.timespan
Code is:
m_startTime = CType(Item.FindControl("txttimeFrom"), TextBox).Text
m_endTime = CType(Item.FindControl("txttimeTo"), TextBox).Text
I have to use timespan variable because my database has time(7) datatype column also the stored procedure.
any idea...

Related

What does "read_strt" meaning here?

What does this vbscript code mean?
<%=read_strt(objRS, "ccnumber", "")%>
I want to know whats the meaning or used of read_strt on the code?
Any ideas?
The statement writes the return value of a call to the function "read_strt" to the HTML output stream. The function seems to read the value of a field/column in the current row of a database query (recordset), convert its type to String and/or test it against 'bad' (e.g. Null) values; in that case the default value ("", empty string) is returned.

Store Variable value from server to client

I am using this code to connect to server.
'Client-Side Connect Code
sockMain.RemoteHost = 192.168.1.125
sockMain.RemotePort = 12345
sockMain.Connect
'Server Side code to send message to client
sockMain.SendData txtSend.text
Now, if i write :: a="127" , and send it to client from server, then this message will be displayed in textbox on client side , now how can i use this message , a="127" to store variable value ?
You cannot literally create a new named variable within a compiled VB6 application at runtime in the manner described. You can, however, certainly extract the numeric portion of the value in the textbox and assign that value to a local variable in the application.
If you want to capture the numeric portion of the value in the textbox, and you know the text format will always be of the form "a=somenumber," you can strip off the first two characters to eliminate the "a=" portion, and then use the VB `Val' function on the remaining string to capture the numeric value:
' Generalized example for pulling integer portion from
' a textbox of the form 'a=12345'; amend as appropriate. Untested.
Dim a as integer
Dim receivedData as String
' Assuming txtBox1 as the name of the textbox in the client
receivedData = txtBox1.Text
receievedData = mid$(value,3)
a = Val(receivedData)
`

Passing Field Symbol value to Return parameter of method

I have the below code which uses a method. When I try to assign the Field Symbol value [Type ANY] to the return parameter RO_TAB [Type Ref to Data], I am getting an error message OBJECTS_MOVE_NOT SUPPORTED [Conversion of type "l" to type "g" not supported.].
The issue is happening after a BW system upgrade along with which we also moved to ABAP objects. The code executes perfectly in the older version of ABAP.
The dump occurs in the below line:
RO_TAB = <lf_storage>.
I have no idea why.
method GET_LU_STORAGE_FOR_ODS.
* IMPORTS
* IF_ODS TYPE RSODSTECH
* IF_ODS_TABLE_TYPE TYPE ZODS_TAB_TYPE
* RETURNS
* RO_TAB TYPE REF TO DATA
FIELD-SYMBOLS:
<lf_storage> TYPE ANY.
DATA:
lf_index TYPE SY-TABIX,
lf_sindex TYPE STRING,
lf_name TYPE STRING.
lf_index = GET_LU_STORAGE_INDEX(
IF_ODS = IF_ODS
IF_ODS_TABLE_TYPE = IF_ODS_TABLE_TYPE ).
lf_sindex = lf_index.
CONCATENATE
'MO_LU_DATA_'
lf_sindex
INTO lf_name.
ASSIGN lf_name TO <lf_storage>.
RO_TAB = <lf_storage>.
endmethod.
You need to create a data object first, using the CREATE DATA statement. Then you can ASSIGN a field symbol to work with the dynamically created data object. There's an example in the online manual. A field symbol is not a reference, it simply places the variable assigned to it in its position. You're effectively trying to move a string (which is what lf_name is) to a reference variable, and that won't work.
You cannot assign a variable of type STRING to a variable of type REF TO DATA.
The following code snippet shows how it should be done.
DATA: lf_name TYPE string.
DATA: lo_tab TYPE REF TO DATA.
FIELD-SYMBOLS: <lf_name> TYPE string.
lf_name = 'test'.
GET REFERENCE OF lf_name INTO lo_tab.
*lf_name = lo_tab. "this is not allowed
ASSIGN lo_tab->* TO <lf_name>.
So in your case it would be sufficient to define a field symbol.
FIELD-SYMBOLS: <lf_name> TYPE STRING.
then assign the contents referenced by RO_TAB to this field symbol.
ASSIGN ro_tab->* TO <lf_name>.
and finally do the concatenation.
CONCATENATE
'MO_LU_DATA_'
lf_index
INTO <lf_name>.
That's all! No further assignments should be required.
How about just this?
lf_sindex = lf_index.
CONCATENATE
'MO_LU_DATA_'
lf_sindex
INTO RO_TAB.

How to set variable values to specific cell or element in BIRT

I have declared variable in beforeFactory of BIRT Report.
For example:
This variable I am incrementing in table row render like:
Now when all the rows are rendered I want to set above variable to specific cell/ element. I tried
document.getElementName("numberOfMobilityFilesProcessed").text = numberOfMobilityFiles;
AND
reportContext.getDesignHandle().getElementByID
but they are not working out for me.
I had some problems with temporaly local variables used at multiple steps of datasource scripting so I always used global persisting.
After changing your variable you convert it to a String (because only Strings can be persisted) and before editing your variable again, you load the String from persisted context and convert it to the type you want (String to Integer are automatically converted by JavaScripts dynamic typed variables, but don't forget the toString() when you are saving otherwise you will risk an error).
Because you are using reportContext.setPersistentGlobalVariable your variable is accessable in every Element of your Report.
Example:
var rowNum = reportContext.getPersistentGlobalVariable("row_number");
if(rowNum == null){
rowNum = -1;
}
rowNum++;
reportContext.setPersistentGlobalVariable("row_number", rowNum.toString());
Ok, you have a text element displaying a number of row in a table element. The text element appears before the table in the report.
If you are using two separate tasks RunTask and RenderTask:
Add a report variable in your report (see "variable" node on the Data Explorer view). Then you can change the report variable in onCreate() event handler of the table row:
vars["numberOfSomething"] = vars["numberOfSomething"] + 1;
and access its value in an onRender() evenet handler of some text element, for instance DynamicText:
this.text = "Number of something: " + vars["numberOfSomething"];
If you are using RunAndRenderTask, you must look for another approach. In this case an order of onCreate() and onRender() calls is different. You could bind the same DataSet to the text element displaying the counter, as the one bound to the table. Than you can add an aggregation binding to the text element that will count all rows in the dataset.

How to assign the text box value to a variable

I wanted to get the t#test.com value from the text box which has introduced as the (By.Id("Email")) and compare with the selectEmail value. I have used the following code, but it doesnot take any value which was saved from the text box in the text box. When I debug it I could get only null value for the foundEmail variable.
var checkEmail = driver.FindElement(By.Id("Email"));
string foundEmail = checkEmail.Text;
string selectedEmail = "t#test.com";
Assert.AreEqual(foundEmail, selectedEmail);
Please help me to assign the t#test.com value from the text box to the given variable called foundEmail.
Thankyou
You are using checkEmail.Text please use following code
string foundEmail = driver.findElement(By.id("Email")).getAttribute("value"))
Try it
Thanks.

Resources