What training do I need for Date Input Views? - voice

What kind of training do I need to get https://bixbydevelopers.com/dev/docs/reference/type/input-view.render.date-picker working with voice input?
I have the following view for selecting a Birthday.
input-view {
match:Birthday
render{
date-picker{
initial-value (now().date)
restrictions {
min-allowed ("subtractDuration(now().date, 'P36500D')")
max-allowed ("subtractDuration(now().date, 'P0D')")
}
}
}
}
I've tried this training:
[g:Birthday:prompt] (January 1st 1950)[v:Birthday]
I'd like to be able to say "January 1st 1950" and for this form to interpret that as a date.

For the training, instead of the Birthday model which was a time.Date, I used time.DateTimeExpression and it worked.
[g:Birthday:prompt] (January 1st 2019)[v:time.DateTimeExpression]

Related

Finding JSONPath value by a partial key

I have the following JSON:
{
"Dialog_1": {
"en": {
"label_1595938607000": "Label1",
"newLabel": "Label2"
}
}
}
I want to extract "Label1" by using JSONPath. The problem is that each time I get a JSON with a different number after "label_", and I'm looking for a consistent JSONPath expression that will return the value for any key that begins with "label_" (without knowing in advance the number after the underscore).
It is not possible with JSONPath. EL or Expression Language does not have sch capability.
Besides, I think you need to review your design. Why the variable name is going to be changed all the time? If it is changing then it is data and you need to keep it in a variable. You cannot keep data in data.

Update SalesLine Unit price on changing the size in Microsoft Dynamics AX 2012 R2

how to approach this? Change the value of unit price in the Sales line on changing its size, As far as I know the default unit price comes from trade agreements. In this case there would be no size, but for my requirement I should assign value from trade agreements for sizes 1,2,3,4 and for 5 and 6 the the value from trade agreements should be incremented with 1. i.e
For example sizes 1,2,3,4 -> 13$ and sizes 5,6 -> 14$
I am thinking to approach this making changes in the modified field method on InventSizeid in SalesTable form, is this the right approach or is there a better way to do this. Any help appreciated, thanks in advance
Check SalesTable form go to Data Sources/InventDim/Fields/InventSizeId/Methods/Modified open modified method, you need add your logic in the end of this method.
For example (this is standar method modified):
public void modified()
{
SalesCalcAvailableDlvDates salesCalcAvailableDlvDates;
super();
salesLine.modifyInventDim(inventDim, fieldNum(InventDim,InventSizeId), !salesLine.MatchingAgreementLine);
if (salesLine.DeliveryDateControlType)
{
salesCalcAvailableDlvDates = SalesCalcAvailableDlvDates::newCommonSalesDlvDateType(salesLine,0,inventDim);
salesCalcAvailableDlvDates.modifiedFieldBeforeInsert(salesLine);
}
salesLine_DS.cacheCalculateMethod(tableMethodStr(SalesLine,itemName));
//Your logic
...
...
...
SalesLine.SalesPrice = 999; //Your new sales price.
//Your logic END
}
you probably need to perform salesLine_DS.reread(); or salesLine_DS.refresh(); to see new price (else press F5 in form).
You can specify prices for product variants based on size, color etc. using the trade agreements. Please check the following link.

Design a custom year view with 12 month slots

Sample View:
I would like to create a custom year view to show the timeline in every month slots. I can use fullcalendar-scheduler with a custom view and define like this:
views: {
timelineCustom: {
type: 'timeline',
buttonText: 'Year View',
duration: {year:1},
slotDuration: {month:1}
}
}
However, there is no way to set up a fiscal year view with month start at April 1st and end at March 31st next year. And also, a timeline bar will cover a whole month slot even though an event only starts from the second half of that month.
Your first problem - starting the view in April and ending in March of the following year, can be solved using the new "visibleRange" option. This lets you supply start/end dates for the view, relative to the "currentDate" (i.e. the date fullCalendar curently regards as being selected). You also have to set the "dateIncrement" option, to ensure that Next/Previous increment the current date by 1 year.
N.B. This requires fullCalendar 3.3.0 and Scheduler 1.6.0, or later.
timelineCustom: {
type: 'timeline',
buttonText: 'Year View',
dateIncrement: { years: 1 },
slotDuration: { months: 1 },
visibleRange: function(currentDate) {
return {
start: currentDate.clone().startOf('year').add({ months: 3}),
end: currentDate.clone().endOf("year").add({ months: 4})
};
}
}
See https://fullcalendar.io/docs/current_date/visibleRange/ and https://fullcalendar.io/docs/current_date/dateIncrement/ for more details
However, your issue where the timeline bar covers a whole month slot even though an event only starts in the second half of a month, is not really solvable in the way you want. The whole point of "slots" is to be the minimum time that an event can be displayed for in that particular view. If you want it to be more subtle than that, you would have to define shorter slots. The same thing happens in fullCalendar's default "Month" (non-timeline) view - all events cover a whole day even if they're timed, but you can see the times in the description. I see in your example you have already got the dates of those events displayed in the description, so it should be reasonably clear for your users.
I suggest your users click on the Month View to get a more detailed breakdown with the slot durations more accurately displayed. Either that or you have to compromise and set slotDuration to something smaller.

Form Running Totals, Ax 2009

Is there an example anywhere of a form that performs running totals in a column located within a grid. The user ordering and filtering of the grid would affect the running totals column.
I can easily perform the above if it was ordering only by transaction date, but including the user ordering and filtering I presume that we would have to use the datasource range() and rangecount() functions (see SysQuery::mergeRanges() for an example) then iterate over these to apply the filtering, then include the dynalinks. The same for the ordering, albeit this is now more complicated.
Any suggestions appreciated. Any appreciations suggested (as in: vote the question up!).
You could implement it as a form datasource display method using this strategy:
Copy the form's datasource query (no need for SysQuery::mergeRanges):
QueryRun qr = new QueryRun(ledgerTrans_qr.query());
Iterate and sum over your records using qr, stop after the current record:
while (qr.next())
{
lt = qr.getNo(1);
total += lt.AmountMST;
if (lt.RecId == _lt.RecId)
break;
}
This could be made more performant if the sorting order was fixed (using sum(AmountMST) and adding a where constraint).
Return the total
This is of cause very inefficient (subquadratic time, O(n^2)).
Caching the results (in a map) may make it usable if there are not too many records.
Update: a working example.
Any observations or criticisms to the code below most welcome. Jan's observation about the method being slow is still valid. As you can see, it's a modification of his original answer.
//BP Deviation Documented
display AmountMST XXX_runningBalanceMST(LedgerTrans _trans)
{
LedgerTrans localLedgerTrans;
AmountMST amountMST;
;
localLedgerTrans = this.getFirst();
while (localLedgerTrans)
{
amountMST += localLedgerTrans.AmountMST;
if (localLedgerTrans.RecId == _trans.RecId)
{
break;
}
localLedgerTrans = this.getNext();
}
return amountMST;
}

Qt three ComboBoxes for a date

I have been looking around Google and Stackoverflow, but I have yet to find out if there is any simple solution to auto-filling three comboboxes to represent a correct date (like YYYY-MM-DD). I would presume it would be related to QCalendarWidget. Any ideas?
I want to be able to scroll through current time to dates from X years ago, it shouldn't have non-existant dates like February 29, 2011. Not sure if this is asking for too much.
Now i get what's your idea.
The answer is simple. Make three combo boxes: Day (1 - 31), Month (1 - 12) and Year (i.e. 1999 - 2012). Create "OK" button. No ultra-logic is needed.
After button being pressed just validate the date by creating QDate object with three numbers given by user and calling QDate::isValid(). If it isn't, create some warning prompt and ask user to change something in input.
The best way to validate the data entered by user is to override QDialog::done() method.
void Dialog::done(int r)
{
if(r == QDialog::Accepted) {
QDate date;
//Create QDate from comboboxes' values
...
if(!date.isValid()) {
//Some warning to user.
return;
}
}
QDialog::done(r);
}
int X = 2;
QDate date = QDate::currentDate(), lastDate = date.addYears(-X);
for(; date > lastDate; date = date.addDays(-1))
ui->comboBox->addItem(date.toString("yyyy-MM-dd"));

Resources