If entering a label when a value is specified is redundant do you have to specify the label? Do you just enter a blank string, null value or what?
The Google Docs for _trackEvent() recommend using undefined for optional parameters as needed.
Related
from Typing import Optional
class PostCreateSchema(BaseModel):
contact_phone:Optional[constr(strip_whitespace=True, min_length=8,max_length=10)]
I specified the variable to be Optional but when I submitted the form without filling in the contact_phone field I am still getting the Error "contact_phone: ensure this value has at least 8 characters"
If I remove 'min-length' constraint, it will work as intended and I can submit with an empty field.
How can I make the field optional but yet have a minimum value if filled?
You just need to specify a default value:
class PostCreateSchema(BaseModel):
contact_phone: Optional[constr(strip_whitespace=True, min_length=8,max_length=10)] = None
I am trying to add optional dictionary and list to my keyword, how can assign their default values?
In the RF User Guide you can find examples of how you can add arguments with default values. In short, after the variable you have to add "=" and the value by default. Here is an example:
One Required And One With Default
[Arguments] ${required} ${optional}=default
[Documentation] This keyword takes 1-2 arguments
Log Required: ${required}
Log Optional: ${optional}
While the other answer covers correctly keyword parameters with defeat values, your question is for a default list one.
And this is not allowed by Robot Framework syntax (and in python, having a default value being a predefined list is a source of a lot of pain and hidden bugs :). So the solution for that is to have a parameter which default value is None (usually, really anything the caller would not pass would do), and check was it set in the call; if not - assign it to the default list, inside the keyword:
My Keyword That Accepts Optional List
[Arguments] ${the_list}=${None}
${the default value}= Create List member0 the other one
${the_list}= Set Variable If $the_list is None ${the default value} # no argument passed when the keyword was called
... ${the_list} # an argument was passed, leave the variable as it was
I have a XML to XML map on IBM Sterling B2B Integrator map.
I am trying to set an empty tag on a conditional variable as follows:
empty($my_var[counter][1].#my_var);
The result is that on output the empty tag does not show up.
Expected result:
<my_var/>
Is there any way to achieve this?
The XML element should be declared as mandatory in the map.
The PCDATA property should not have Mandatory checked if it is not required, but the element level should be mandatory.
Note also this known problem:
http://www-01.ibm.com/support/docview.wss?uid=swg21701246
I'm working on some interesting APIs that have a "?" in their path, like so:
/api/?other/stuff/here
However, if I type "?" in the request URL in Paw, it automatically moves my cursor into the query parameter fields. Is there a way to disable this? I'm forced to use postman at the moment to work around this, which is less than ideal.
Nevermind, using %3F instead fixed the issue
As mentioned before, using %3F should work nicely!
Another, more generic way is to use the URL-Encode dynamic value:
Right-click on the field where you want to insert the special character and pick Encoding > URL-Encoding > Encode
A popup opens and you can type your special character (here ?) in the Input field. You should see the preview of the encoded value at the bottom of the popup.
Continue to type the end of the URL after this dynamic value. And you should be good to go!
I am converting a string that is being read from a textbox in gridview
int numTC = Convert.ToInt32(((TextBox)row.FindControl("numTC")).Text);
However it is returning the following exception:
Input string was not in a correct format.
Can anyone see anything wrong in the conversion?
Thanks
Make Sure that your gridview can accept only numbers you can have a filterextender using ajax and I m sure u will do that what else you can do is to check whether you have a textbox is null or not using the Function given below
if(string.IsNullOrEmpty(((TextBox)Row.FindControl("numTC")).Text))
{}
((TextBox)GridViewname.Rows[e.RowIndex].FindControl("numTC")).Text;
and
use this extender or u can use javascript as well
If it is going inside the if statement that means the value is null
if(!string.IsNullOrEmpty(((TextBox)row.FindControl("numTC")).Text)) {}
I have used ! sign now it will go inside the if statement if there is some value in it.
and try to convert this text into integer using try catch block if u get any exception you can take whatever action you want to.
Let me know if it is complete
It is obvious that the value of the returned in the "Text" property of the text box cannot be converted to inter, I guess you have to insure first that you are returning the correct textbox and that it contains a valid value before attempting the conversion.