Reliable way to SendInput before focusing on another Edit? - windows

I have 2 edit controls in another dialog in a different process. For example:
Name: ____
DOB: ____
I want to use SendInput to automatically input those fields because they are customized not accepting windows messages.
The steps:
Focus on Name field
SendInputs with name
Focus on DOB field
SendInputs withe DOB
the problem is sometimes part of chars of name are typed into DBO field. It seems step 3) was performed before 2) was done.
Add extra sleep in step 2) works. I want to know if there is more reliable way to know step 2) is actually done?

Related

MailChimp: Dynamic merge tag when only initial know for first name

We want to use the first name merge tag in our template. However for some small percentage of the audience we only have an initial and not the actual first name. Therefore the campaign would look like "Dear X" instead of "Dear Xavier" for example.
We want these to appear as "Dear Supporter". I know I could do this with an import and update the fields for the ones I have identified. However I do not want to run this every day for new signups.
Is there a way to create a conditional merge tag that results in the first name being used when the length is more than 1 and if the length of the first name is 0 or 1 then "Supporter" is used? Is this possible in MailChimp?
Thanks in advance!

Laravel backpack fields - select_from_array functionality

I am using laravel backpack. Have created a new Request form. Have created several fields to choose from using 'select_from_array':
$this->crud->field('range')->type('select_from_array)->label(__('number range'))
->options(Group::NUMBER_RANGE);
$this->crud->field('range1')->type('select_from_array)->label(__('letter range'))
->options(Group::LETTER_RANGE);
$this->crud->field('range2')->type('select_from_array)->label(__('symbol range'))
->options(Group::SYMBOL_RANGE);
For example, each field has got 3 dropdown values to choose from (to make it more clear, let's say number range has 1 / 2 / 3, then letter range has A / B / C, and symbol range has Sun / Moon / Wind).
I want to apply this functionality - if from number range I select 1, I want that letter range to show me just A and B (and C should disappear from the value choices), and symbol range show me just Wind. Or if I choose field letter range and I choose option value B I want that symbol range field would show me just Sun.
In general I want that fields would react with each other depending on the choices I made on the previous field the next field would show different options I could choose from.
How can I do this?
Thank you in advance :)
Backpack doesn’t currently make it easy to do that, but it doesn’t make it difficult either.
Option A - javascript
You can push a bit of javascript onpage, using the script widget, that will do whatever you want, including this functionality.
Widget::add()->type('script')->content('assets/js/admin/request_form.js');
There’s an active pull request trying to make it easier to interact with fields on the front-end too (PR #4312) but until that is merged, you can use vanilla JS or jQuery to do whatever you want.
Option B - select2_from_ajax
Alternatively, you could use the select2_from_ajax field type, which does allow you to do that using the “dependent” attribute. Since you’re in control of the AJAX endpoint, you can return different results depending on other form choices.
But:
I think making these 3 selects make AJAX requests is overkill, when a bit of JS can do the same for regular selects;
This is a PRO field, so it’s only available if you purchased the PRO addon;

WebEdit and List Combo field Automation using UFT

Hi I am trying to Automate the input field for searching the equity on the website "https://www.nseindia.com/" using UFT. I am able to set value in the WebEdit field but I am not able to submit using UFT
Below is the descriptive code :
Set Obrowser = Browser("name:=NSE - National Stock Exchange of India Ltd\.")
Set oPage = Obrowser.Page("title:=NSE - National Stock Exchange of India Ltd\.")
oPage.WebList("html id:=QuoteSearch").Select "Equity"
oPage.WebEdit("name:=companyED","index:=0").Set "SBIN"
oPage.WebEdit("name:=companyED","index:=0").Submit
enter code here
Image of the field which is highlighted
Could you please help me in handling this type of input box which is shown in screenshot
I see that when you set a value in the search field we get a list of matching results. If you click on the appropriate result the search is performed.
Instead of submit try the following:
oPage.WebElement("html id:=ajax_response").Link("text:=.*SBIN.*").Click
This assumes there is only one match (you can fine-tune it if there are more).
Explanation:
We first look for the list of results that fit the search term (this is in a SPAN with id=ajax_response). Then, under that, we look for the Link that we want to click on. In this case there's only one match so the description doesn't really matter.

Character length in single line edit filter PowerBuilder

My SQL code gives me over 10 000 rows, each containing client id, name, address and so forth. In my PowerBuilder 10.5 window I've set my DataWindow in which I'm retrieving my SQL code using id as retrieve argument. I have a Single line Edit (sle_id) in which the user can write an id and search by it. What I've figured out is that all of my clients have id's length of 8 characters and starting with either "46XXXXXXXX" or "7052XXXX". So to optimize my retrieve time I want to write a code in the clicked event of my "Start" button that is located in PowerBuilder window that would first check if the id starts with one of does two options: "46..." or "7052...". I assume I'd need to use length of the characters? For example, this is what I'd want...
IF sle_id.text STARTS with 46 or 7052 THEN retrieve
ELSE MessageBox ("INFO", "Your id must have begin with either 32 or 7052")
END IF;
Of course, I need something better then "Starts with". Much oblige for all the help!
there are some string functions in powerbuilder. I think you need this:
If( left(sle_id.text, 2) = "46" or left(sle_id.text, 4) = "7052" ) then
Best Regards
Gábor
I think you're trying to solve the wrong problem. Your database should have an index on client id. If the client id is unique use a unique index.

How to validate an optional empty textbox, Is the data valid or not - its optional... -

Today I asked myself how can I handle user input if the user have not to enter it...
A firstname and lastname is all he must enter. The adress he needs not to fill out.
Now I have to decide, is the missing data a user mistake or didn`t the user want to enter
data?
How can I deal with such a scenario?
If the address field is perfectly valid when blank (i.e. "") then I would first do a check against the length of the data within the address text field.
If the length of the data is > 0 then the validation routine should take place, else the form should continue to process...
If you wanted to get slightly more intelligent with this (and depending on your requirements) you could perhaps put some code in place to check whether the user has entered the address box with their cursor at any point and then carry out validation accordingly.

Resources