MDK: Format Simple Property as Number - odata

I have a "QTY" field (simple property) on a page whose value is used in a Function Import. The Function Import expects a Number type.
The error I get in BAS is:
Incorrect type. Expected "number".
How do I set this as a number? There is nothing in the simple property to says it's a number type, other than the "Keyboard Type".
Adding $(N,...) still shows as an error, but deploys fine.

Related

How can I indicate an error during a parse operation?

Within the scripting language I am implementing, valid IDs can consist of a sequence of numbers, which means I have an ambiguous situation where "345" could be an integer, or could be an ID, and that's not known until runtime. Up until now, I've been handling every case as an ID and planning to handle the check for whether a variable has been declared under that name at runtime, but when I was improving my implementation of a particular bit of code, I found that there was a situation where an integer is valid, but any other sort of ID would not be. It seems like it would make sense to handle this particular case as a parsing error so that, e.g., the following bit of code that activates all picks with a spell level tag greater than 5 would be considered valid:
foreach pick in hero where spell.level? > 5
pick.activate[]
nexteach
but the following which instead compares against an ID that can't be mistaken for an integer constant would be flagged as an error during parsing:
foreach pick in hero where spell.level? > threshold
pick.activate[]
nexteach
I've considered separate tokens, ID and ID_OR_INTEGER, but that means having to handle that ambiguity everywhere I'm currently using an ID, which is a lot of places, including variable declarations, expressions, looping structures, and procedure calls.
Is there a better way to indicate a parsing error than to just print to the error log, and maybe set a flag?
I would think about it differently. If an ID is "just a number" and plain numbers are also needed, I would say any string of digits is a number, and a number might designate an ID in some circumstances.
For bare integer literals (like 345), I would have the tokenizer return maybe a NUMBER token, indicating it found an integer. In the parser, wherever you currently accept ID, change it to NUMBER, and call a lookup function to verify the "NUMBER" is a valid ID.
I might have misunderstood your question. You start by talking about "345", but your second example has no integer strings.

How can I solve an incompatible types error when trying to develop a dynamic filter query for D365-specific data types in Azure Logic Apps?

I am currently trying to use Azure Logic Apps to List Items Present in a Table in Dynamics 365 Finance & Operations using a dynamic filterQuery detemined by input at runtime as shown below:
D365 F&O connector for List Items present in table
However, for some of the filter queries, we encounter errors where the data type in D365 is different from the one in Logic Apps, resulting in incompatible type error as shown below:
Error message received from logic app - A binary operator with incompatible types was detected
For reference, to meet the dynamic filtering requirement, what I am doing is appending continuously all required filters to a string in such a manner using a loop, extracting key-value pairs from a JSON payload determined at runtime:
Append to filter query: and eq ''
The fields throwing errors have data types in D365 "enum" and "bool" respectively.
Bool data types have the error: "A binary operator with incompatible types was detected. Found operand types 'Microsoft.Dynamics.DataEntities.NoYes' and 'Edm.String' for operator kind 'Equal'".
Enum data types have the error: "A binary operator with incompatible types was detected. Found operand types 'Microsoft.Dynamics.DataEntities.' and 'Edm.String' for operator kind 'Equal'", where is the name of the key I wish to filter for.
Is there a simple way to resolve this error? Thank you very much!
This ask has been addressed here : https://learn.microsoft.com/en-us/answers/questions/314559/azure-logic-apps-to-d365-fampo-flow-results-in-dif.html
However, in this kind of scenario I would suggest to :
First run the Flow with Dynamics action without the filter.
Second check the results of the Flow run, and look for the value you want to put the filtering on.
Third copy the field name (without quotes) and use that property name ( with the conditions) in the filter.

Problem reading variables containing mix of numbers and strings

I am reading an Excel file (see syntax below) where some of the fields are text mixed with numbers. The problem is that SPSS reads some of these fields as numeric instead of string and then the text is deleted.
I assume this happens in cases where a large part of the first rows are empty or with a numeric value and then it defines the variable as numeric.
How can this be avoided?
GET DATA
/TYPE=XLSX
/FILE='M:\MyData.xlsx'
/SHEET=name 'Sheet1'
/CELLRANGE=FULL
/READNAMES=ON
/DATATYPEMIN PERCENTAGE=95.0
/HIDDEN IGNORE=YES.
When you use the get data command, the subcommand /DATATYPEMIN PERCENTAGE=95.0 tells SPSS that if up to 5% of the values in the field do not conform to the selected format it's still ok. So in order to avoid cases where only very few values are text and the field is read as number, you have to correct the subcommand to:
/DATATYPEMIN PERCENTAGE=100

Current value in Range validator ErrorMessage - MVC 5

This may be something really simply, but I just can't find any examples that do what I'm trying to do.
I'm trying to display the current value in my rangeattribute validator for my model.
I'm trying to decorating my property like so...
<Required>
<Display(Name:="Invoice(s) Amount")>
<Range(1, Decimal.MaxValue, ErrorMessage:="The value '{don't know what goes here}' is not valid for {0}.")>
<DataType(DataType.Currency)>
<DisplayFormat(ApplyFormatInEditMode:=False, DataFormatString:="{0:C2}")>
Public Property InvoiceAmount As Decimal
I've seen lots of examples where {1} and {2} are used to display the min and max for the range. However I haven't seen anything where the current value is displayed.
If I enter some non-numeric value, it displays the default messages as...
The value 'asdf' is not valid for Invoice(s) Amount.
This is why I'm assuming there aught to be some way to do it also for the range.
So essentially what I want to do is display the same kind of message when the value is a valid decimal, but is outside the allowed range, so it could be something like...
The value '-100' is not valid for Invoice(s) Amount.
It seems like it should be really simple.
I don't think this can be done with RangeAttribute, but create a class inherited form RangeAttribute and you can override the default behaviour and do what you like.

Why can't I enter a decimal point in a bound UITextView?

I'm binding a UITextView to a field of data type float, and it seems that the binding mechanism is being over-vigilant in validating my data such that I cannot actually enter floating point numbers.
Specifically, if I type "7" in my UITextView, the float field in the data model updates. If I paste "7.2" in the text view, it also updates. But if I type "7." (on the way to typing "7.2"), the binding fails with error:
MvxBind:Error:365.27 SetValue failed with exception - FormatException: Invalid format.
This is arguably correct, since "7." isn't a valid numeric string.
But it also discards the decimal point, and so I can't enter my number. It just leaves "7" in the text view. The weird thing is that this is ONLY affecting the decimal point/period character. If I type "7X", it doesn't bind, but it does let me type the X. What's going on here?
Just may be try to bind to string value and make a little manually in code string<=>float conversions? Also this should be much better way on monotouch specifically since based on the common .net functions rather than on the UI implementation.

Resources