How to type into text box generated dynamically - uipath

I am trying to input data into a dynamically generated text box, but i get the following error:
Cannot find the UI element corresponding to this selector: <webctrl id='dp1545483054838' tag='INPUT' />
Steps to reproduce the issue:
Go to www.mockaroo.com
Rename gender to date
Click on on Gender under Type and type date in the search and then select Date
This will display two fields from date and to date (dynamically generated). I want change the date in these fields.

Similar to the comments, I did not have any issues creating a selector to target the start of range or end of range date fields.
However, in practice, as the form is dynamic, the IDs of the fields will change each time you load the page or introduce a new field so I would not recommend using the ID to select the field.
I dabbled on the page a little to get a feel for it and here are the tidbits that I noticed that might help you out. Without seeing a sample of what you've tried already, this is just a guess at what you are trying to achieve.
Ui Explorer generates the following by default
<html app='chrome.exe' title='Mockaroo - Random Data Generator and API Mocking Tool | JSON / C*' />
<webctrl id='dp1546757265980' tag='INPUT' />
Check that you are in scope of your selector if you are wanting it to be relative or ensure you are correctly defining a valid hierarchy if using an absolute.
Determine a good hierarchy and a few attributes to use that would allow you to specify the field you want while not using attributes or values that are too ambiguous or would never be the same twice
The first thing that I noticed for the start and end date fields is they have a title attribute start of range and end of range values respectively. I think this would be a good start, for myself I ended up including a few more attributes.
<webctrl tag='INPUT' aaname='start of range' name='*min_date*' parentclass='options' parentid='fields' />
Thinking about this a step further, due to the nature of the form you could have multiple option fields that are of the type Date, so I anchored my selector to the date name field to ensure I was targeting the correct options.
While adding the anchor I noticed that after changing the name field from "gender" to "date" that the HTML code did not update the value to reflect this so it still had the original content
<input placeholder="enter name..." class="column-name form-control" spellcheck="false" type="text" value="gender" name="schema[columns_attributes][4][name]" id="schema_columns_attributes_4_name" uipath_custom_id="1">
So instead of being misleading the second time I selected/anchored the Name field, I added a Find Element activity and created an output Ui Element variable to pass to the other activities.
Sample XAML project

Related

Kentico 12: change value of one page type field based on value of another field

I have a custom page type with two fields, StateName and StateCode. I would like it so that when a value is selected in either of these fields, the other field’s value changes to match.
So for example, if I select “Alabama” in the StateName field, the value of the StateCode field would automatically change to “AL.” Or if I select “CO” in the StateCode field, the StateName field would automatically change to “Colorado,” etc. Is this possible?
(I have to keep these as two separate fields, because I need to display either the state name or the state code on the front-end depending on context. Therefore, I can’t use a single field with options like AL;Alabama because then the field only returns the value AL and I have no way of getting the display name Alabama).
I know Kentico has options for setting “dependent” fields, but that only appears to determine visibility – e.g. only display Field B if I select a particular value in Field A. I can’t find a way to actually change the selected value in one field based on the selected value in another field.
Two control solution seems some kind of an overkill here. You can use StateInfoProvider to get what you want.
StateInfo state = StateInfoProvider.GetStateInfo("Alabama")
The other way would be to use a simple drop down control and use
query like that :
select stateCode + '|'+ StateDisplayName, StateDisplayName from cms_State
to get get code and display name as value separated by |

Dynamics 365, Entity View, format date field to "Month Year"

I am working on an entity view that displays billing records with associated date. This date field needs to be displayed as "Month - Year". Unfortunately, I am not able to find a way to format this date field outside of modifying the entity and even then, I only have the option for date only or date and time.
I have noticed that I can select the field and click on Change Properties. There I have "Web Resource" and Function Name. I have tried creating a web resource with a function that returns some data. Set everything up, saved and published. This function is not even found in dev tools. Only examples that I have for it are dealing with using this method for icons:https://www.c-sharpcorner.com/article/view-customization-with-javascript-in-dynamics-365/
In another example the suggestion is to use calculated fields, but this would cause me to lose date sorting and filtering on the form.
That view-based JavaScript seems to be to choose an icon. I'm not sure it would allow you to reformat actual data in the view. And if you're looking for assistance with trying to do that, you'd probably get more help if you posted the code.
Besides the JavaScript approach, you might want to think about creating a separate text field to hold the "Month - Year" value. Then you could use a workflow, plugin, or JavaScript to populate it when the datetime field changes.
One of the free workflow tool packages (Jason Lattimer's, Aiden Kaskela's, or Andrew Butenko's) probably has the ability to parse the date so you can format the month and year, and store the string in the separate field. This would be a no-code option.
Alternatively, you could write a plugin to reformat the datetime values and register it on the RetrieveMultiple message of the entity.
I'd probably go with a separate field and an off-the-shelf workflow utility to populate it.
There are several ways:
1. Setting->Administration->System Setting->Format->Customize,
2. http://prntscr.com/ph42nc,
3. or use on load with js to change date format more on this subject here: How to change date format in JavaScript

GWT (smartgwt) grid sort selected records top

I have a grid where the user can select records via checkbox in front of every record. Now I have a requirement to sort the records based on their selection, so that all selected records should be placed top, followed by the not selected ones.
Is there any standard function to achieve this? As an alternative I thought of saving the selection state as an attribute on every record and sort based on the attribute.
The code for the column is:
gridRealmDt.setSelectionType(SelectionStyle.SIMPLE);
gridRealmDt.setSelectionAppearance(SelectionAppearance.CHECKBOX);
I try to describe the code I use as the affected code is deeply nested in our own framework classes.
gridRealmDt is a subclass of smartgwt ListGrid. In my Dialog a create an instance of the grid which creates an instance of a database bound datasource. When the dialog is loaded the records are fetched from the database and after that a registered an dataArrivedHandler where I select the records which match records from another table.
I tried to place the selection attribute in an extra field and use that for sortig before my other sort criteria, but this does not work. Here is the code for the field I am using.
ListGridField txtSelected = new ListGridField(SELECTED, "");
txtSelected.setHidden(true);
txtSelected.setSortByDisplayField(true);
txtSelected.setCanSortClientOnly(true);
When I do not set the canSortClientOnly property the order by is sent to my database resulting in an error, as the table does not contain that field, so I set the property. Now I get following error
Removing field from the sort Specifier array because it specifies canSort Client Only: true and all data is not yet client-side.
I also tried to use a sortNormilizer on the Name field which is my main sort criteria, but the normalizer is called before the selection value is set to the record.
record.setAttribute(CARealmDS.SELECTED,selected ? "a" : "b");
I also cannnot find a way to call the normalizer when selection changes.
Currently we are using Smart GWT Version 6.0p.
I don't think there is any standard function. Just use grid store update. Place checked items first.

Entity Framework is padding out my text fields although they are not Fixed Length

I am building an MVC3 site using Entity Framework 4 and I'm having a problem with fixed length fields.
When I look at my code during debug it shows that MyEntity.Title="Hello name " with the title padded out to the maximum length of the field.
This is usually a question of having fixed field length in the EDMX file or using a char data type on the underlying database rather than a varchar. In this case neither of those is correct, however it is possible that the problem fields were of fixed length originally. I have manually changed each field in the EDMX ( and the model has been regenerated ) and the fields were never fixed length in the database ( which was the starting point for the application ) so I guess that the need to pad out the fields is being stored somewhere in the Entity Framework configuration and hasn't been updated.
The problem occurs in new records when they are added to the database- when the object is created the Title will be correct, when it is instanciated from the database it is padded.
What do I need to do in order to get rid of the padding, which is really screwing up my string comparisons unless I trim everything?
It turns out that in the .EDMX file the padded files were still listed as nchar. This wasn't visible through the Model Editor, the only way to change it was to right-click on the model in Visual Studio and select "open with..." then use an XML editor. The offending fields looked like this:
<Property Name="MyProperty" Type="nchar" Nullable="false" MaxLength="50" />
Changing the Type to nvarchar and running the template again seemed to clear the problem up.
Existing fields do not get updated in the model when you update it from the database. You either have to delete the entities from the model, or manually change those fields to the new values.
Check the property types in the Model Browser and make sure they are correct.
Change your Title field to have the Fixed Length property set equal to true. It's probably defaulting to none :)
Make sure you make the change in the dbase first and then update your edmx.

Magnolia CMS: Duplicate data validation in spring blossom paragraph

I have a paragraph defined in spring blossom which consists of edit,file, select and date controls. Now I want to allow only one data entry for each date in that page, i.e. date field should be unique. How can I do duplicate data validation based on date field in DailogValidator?
Thanks,
Rupali
In the validator you have access to the content and can iterate through it looking for a paragraph having the same date.
You can get the content either from MgnlContext.getAggregationState() or by adding DialogCreationContext as an argument to your validator method.
When iterating the content of the page you should be looking at nodes of type ContentNode having the same paragraph. The paragraph assigned to the node is set in the nodes MetaData as 'template'.
This code does basically the same thing but you might want to change it from searching by class to searching for name instead.
Hope that helps!

Resources