PowerApps - autofill date for newform - autofill

Using PowerApps, how can I get the current date to be autofilled into a new form?
Does the code go into the IconNewItem1 function from the parent BrowseScreen1?
NewForm(EditForm1);Navigate(EditScreen1,ScreenTransition.None)
as something like ...
BrowseGallery1.Selected.Date = Now
Or does the code go in the EditScreen1 / EditForm1 area as a rule?
Any guidance or suggestion would be appreciated.

You would do that in the form itself (or the date picker control of the form). Select the card that has the date value, and in the right-side pane select the 'Advanced' tab. You'll need to unlock the card to change the properties, and when you do, change the Default property of the card from
ThisItem.DateTimeColumn
to
If(EditForm1.Mode = FormMode.New, Now(), ThisItem.DateTimeColumn)
Where DateTimeColumn would be replaced with the name of the column in your data source, and EditForm1 would be replaced with the name of the form control.

Related

pentaho first steps: link combobox to chart

I'm completely new to SO, Pentaho, and have a (very) limited knowledge on js and jquery.
I need a simple requirement: whenever my combobox changes (2 values: budget or estimate), I need to reload my chart.
What I've tried so far:
In Components panel, I've added a
-Simple Parameter
--Name: param_budget_or_estimate
--Property value: budget
-Select component
--Name: BudgetEstimate_Select
--Parameter: budget_or_estimate
--Datasource: budgetestimate_query
-CCC Pie Chart
--Name: piechart_linecosts
--Listeners: added param_budget_or_estimate
--Parameters: arg param_budget_or_estimate, value param_budget_or_estimate
--Datasource: budgestimate_piechart
In Datasrouces panel, I've added a
-sql over sqlJndi query budgetestimate_query, named budgetestimate_query, that returns a
select distinct budget_or_estimate from budget_or_estimate;
-sql over sqlJndi query named budgetestimate_piechart, that returns a
SELECT COST_LINE_NAME
,amount
FROM VI_LINE_COSTS_PIE_CHART
WHERE budget_or_estimate=${param_budget_or_estimate}
;
Yet, I fire up my dashboard and changing the combobox changes nothing.
What am I doing wrong?
Thanks in advance!
First, you need to create a parameter. Let it be named parameter_one.
Then, you set your select component to have parameter_one as Parameter property (so it propagates the onchange event's value to the parameter).
Now, the piechart must have parameter_one as listeners, and parameter_one as parameters (arg=parameter_one, value=parameter_one). So, you declare that whenever parameter_one changes, the piechart should be reoloaded (listener) and that parameter_one's value is relevant to the calculation (parameter).
Finally, the piechart DataSource should look like:
select A.id,A.value
FROM
(
select '1' as id, 10 as value
union all
select '2' as id, 20 as value
) A
WHERE A.id=${parameter_one}
;

CRM 2011+ SSRS Report + Currency Formatting

I have created a ssrs report in CRM online using BIDS.
Generated well but those currency field which is negative shows on the report with bracket.
All positive currency fields showing well on the report but negative currency field is showing with bracket like "(value)" on the report.
May do this like "-$value" or something else.
Please help.
You need to change the settings inside the placeholder properties, right click on the field in Design mode and you can choose also the format for negative values
You can try setting the textbox Format property using an explicit format string, something like:
$#,#;-$#,#;$0
To edit a textbox Format property click on the textbox then edit the Format value in the Properties tab:

Ext JS 4 - how to add a time stamp to a text area form field?

I have an form with a text area field. I want to add some text (a date/time stamp) when the user clicks in to the form. I am assuming I need to catch a click type event when the user clicks in to the field and then edit the field value and insert the text I want. Is this the best approach?
Looking for suggestions based on using Ext JS 4 / MVC.
As mentioned by you - "I need to catch a click type event when the user clicks in to the field" - One way to achieve this and appending of timestamp to the value could be by using the focus event in following manner:
focus:function(){
var value = this.getValue();
value += new Date().getTime();
this.setValue(value);
}
Just that the date used here is the client's system date.
Hope this helps.

SmartGwt DateItem useTextField=true - how to make text entry field UNeditable

Since I can't figure out how to solve my problem presented here I'm thinking for the moment at a temporary solution.
I have a smartgwt DateItem widget:
DateItem date = new DateItem("Adate");
date.setWidth(120);
date.setWrapTitle(false);
date.setAttribute("useTextField", true);
date.setAttribute("inputFormat", "yyyy/MM/dd");
date.setAttribute("displayFormat", "toJapanShortDate");
Because the attribute useTextField is set to true we can see the text entry field. How can I make this text entry field to be uneditable.
Actually I want to have only the possibility to choose the date from calendar and not to change it manually.
Resolved - the issue exposed above - thanks to #RAS user.
TextItem textItem = new TextItem();
textItem.setAttribute("readOnly", true);
date.setAttribute("textFieldProperties", textItem);
Related link
But I have now another issue (resolved - see here):
The date chooser won't show the date on the text field but Today's date.
For example, enter 30/05/2009 on the text field, go to another field, then come back on click on the date chooser and the selected day will be Today's date instead on June 30th, 2009. Which is the reason for this? Can this be solved?
Also let's say I let to the user to opportunity to manually modify the date - can I put some **validators on it?** (still need an ideea on this)
Thank you.
date.setEnforceDate(true);
http://www.smartclient.com/smartgwt/javadoc/com/smartgwt/client/widgets/form/fields/DateItem.html#setEnforceDate%28java.lang.Boolean%29
You have a lot of different validators. Depending on the context it must be possible to validate cardinality, relation to other data items, datatype(not only date time values) and relations to other external records.

Dynamic JQuery date picker code

I need to create dynamic filter that adds/removes rows dynamically.
It contains a drop-down box. Depending upon the drop-down box value selected, I create a dynamic <TD> that may have a text field or drop-down list.
If it's a text field, then I have to add date picker for that text field.
I have done this, except date picker for dynamically generated text field.
If you're creating 100 rows, the text fields' names should be same for all rows.
How to add datepicker for dynamically generated text field?
I had the same issue.
You would need to rebind the DatePicker to the dynamically added row.
The date picker associates a hadDatePicker Class to the dynamic row.
So you would need to remove that and rebind.
Something like this -
jQuery('.date-pick').removeClass('hasDatepicker').datepicker({
dateFormat: 'mm-dd-yy'
});
Regards,
Tina Agrawal
Actually i did use the solution provided by #Tina Agrawal But since now, when i select a date from the calendar, i click again and re-select. If i click on next month, it will go to 1900-01-01.
Well it was so strange...
After two hours of trial and errors and research.
i simply did:
$('.date-pick').live('click', function(){
$('.date-pick').datepicker();
});
Well it works.
I had the same issue and solved it in a different way. Although I am not very sure why is it working as I am very new to jquery. I wrote the following and it iterates the entire set of controls having the class "class_date" and rebinds the datepicker control to it.
$(".class_date").removeClass('hasDatepicker').datepicker();
Tirst add a class attribute as "date" to your input or div.
After dynamically add a text input to have to recall $('.date').datePicker() again to bind datePicker to new inputs or div.
I had a similar problem in that when dynamically adding new rows to my table the Date Picker fields in the new rows (any row added to the DOM dynamically) were all updating my initial rows Date Picker fields.
Removing the hasDatepicker class as suggested above was not enough to solve my issue, probably as I was using .clone() to create my dynamically added rows.
The solution when cloning rows was to remove the cloned input fields, re-create them, add them to my newly cloned table row and THEN re-initiate the Date Picker
For example:
//Remove exisiting cloned input fields
new_row.find("td.date input").remove();
//Create new input fields and append to table td
var date_tds = new_row.find("td.date");
$('<input />', {"name":"gStartDates["+n_array_pos+"]","type":"text"}).appendTo(date_tds[0]);
$('<input />', {"name":"gEndDates["+n_array_pos+"]","type":"text"}).appendTo(date_tds[1]);
//Re-initiate datepicker on the input fields
new_row.find("td.date input").datepicker({
dateFormat:"dd-mm-yy",
minDate:StartDate,
maxDate:EndDate
});
Use JQuery Live to access the dynamically created DOM.
http://api.jquery.com/live/
The you can attached the picker.
http://jqueryui.com/demos/datepicker/
one should use ".on" instead of live - see
http://api.jquery.com/on/