ExcelJs: Multi Line Error message in dialog box - exceljs

I'm using exceljs for create excel file, and adding validation in it. I can write the error message also in the validation object, but I'm able to make it multi line.
For Example:
On Error, I want to show the message in this format:
Hi,
I seems that you have enter value out of range.
Please enter the values within the range.
For this tried using string template / \r\n, but they dont work. I want it to look like this:
cell.dataValidation = {
type: 'decimal',
operator: 'between',
formulae: [0.0, 1.0],
allowBlank: false,
showErrorMessage: true,
error: `Percentage value must be between 0 and 1.
For 10%, enter .1.
For 12.5%, enter .125.
For 0%, enter 0.
For 100%, enter 1`,
};

Related

Custom wireshark disector shows value but fieldname is not visible using lua

I am testing some network packets of my Organisation's product. We already have custom plugins. I am trying to add some some more fields into those existing plugins (like conversion of 2 byte code to a string and assign it to a field)
Thankyou in advance for reading my query.
--edit
Wireshark version : 2.4.5 (organization's plugins dont work on latest wireshark application)
--edit
Problem statement:
I am able to add field and show value, but fieldname is not displayed as defined.
I cannot share the entire .lua file but i will try to explain What i did:
Below is the image where I have a field aprint.type. this is a two byte field. In .lua file, for display purpose it is appended with corresponding description using a custom function int_to_enum.
I want to add one more proto field aprint.typetext which will show the text.
What I did:
Added a protofield f_apr_msg_type_txt = ProtoField.string("aprint.typetxt","aprint_type_text") (Tried f_apr_msg_type_txt = ProtoField.string("aprint.typetxt","aprint_type_text",FT_STRING) also)
Below the code where subtree aprint.type is shown, added my required field as subtree:add(f_apr_msg_type_txt, msg_type_string) (Below is image of code extract)
I am able to see the text but field Name is shown as Wireshark Lua text (_ws.lua.text)
Normally displaying strings based on numeric values is accomplished by a value string lookup, so you'd have something like so:
local aprint_type_vals = {
[1] = "Foo",
[2] = "Bar",
[9] = "State alarm"
}
f_apr_msg_type = ProtoField.uint16("aprint.type", "Type", base.DEC, aprint_type_vals)
f_apr_msg_type_txt = ProtoField.string("aprint.typetxt","aprint_type_text", base.ASCII)
... then
local msg_type = tvb(offset, 2):le_uint()
subtree:add_le(f_apr_msg_type, tvb(offset, 2))
subtree:add(f_apr_msg_type_txt, tvb(offset, 2), (aprint_type_vals[msg_type] or "Unknown"))
--[[
Alternatively:
subtree:add(f_apr_msg_type_txt, tvb(offset, 2)):set_text("aprint_type_text: " .. (aprint_type_vals[msg_type] or "Unknown"))
--]]
I'm also not sure why you need the extra field with only the text when the text is already displayed with the existing field, but that's basically how you'd do it.

Error Message Not Displayed Properly and Wrong Input gets selected

I am using jquery select2 method for multiple selections and for users to enter their own input it uses tags property.
Now I want to display the error message when a user enters wrong input.
Therefore, I am using formatResult property of select2 and checking regex for input.
When the input is correct; it returns the input else it returns error message from the function.
But this message is not coming in the format as it comes for select2 example "No matches found" and even when the error message is displayed, on clicking enter it takes the wrong input.
I want to display the message in correct format and not to select the wrong input on enter.
Please help. Below is my code:
$("#abc").select2({
minimumInputLength:1,
maximumInputLength:10,
formatResult: function(term){
if(term.text === 0)
return "Zero Not Allowed";
else return term.text;
}});
In this code, "zero not allowed" is not coming in the same format as "Please enter 1 or more characters" and when we press enter, zero gets selected.

What are the available condition constants under uiGridConstants.filter?

Did I miss the link that documents ALL the available uiGridConstants for uiGrid fields in one place? I was working on columnDefs filter and found out EQUAL does not work. That's when I realized there is no central documentation for all the condition constants for uiGridConstants.
columnDefs:
[ { }
, { field: '_pointXID', filter
: {
condition: uiGridConstants.filter.CONTAINS, placeholder: '%PATTERN%'
}, headerCellClass: $scope.whatfilter}
, { field: '_statU16', width: "5%", filter
: {
condition: uiGridConstants.filter.EQUAL, placeholder: '=='
}, headerCellClass: $scope.whatfilter}
, { field: '_valDoub', width: "5%", enableFiltering: false }
]
EQUAL's not one of them, and heck how do I know?!
Looks like I have to open up the source ui-Grid.js to find “uiGridConstants.filter.” literals in the code. Here it is, my summary for all the ui-grid’s available filter conditions in these constants 
1. STARTS_WITH
2. ENDS_WITH
3. CONTAINS
4. EXACT
5. NOT_EQUAL
6. GREATER_THAN
7. GREATER_THAN_OR_EQUAL
8. LESS_THAN
9. LESS_THAN_OR_EQUAL
Have I got all of them or still missed something? (Notice that I can’t locate EQUAL in the source, instead, EXACT!)
You guys are asking of whether there is a default condition. I don't believe there's one, but if your input filter.condition value is not any of the above, your Column filter will return a TRUE which means you have no filters!
So in other words, the default is NO FILTERS : anything goes if your condition constant is not valid
Here be central documentation now
It says:
Used in columnDef.filter to configure filtering on the column
SELECT and INPUT are used with the type property of the filter, the rest are used to specify one of the built-in conditions.
Available condition options are:
uiGridConstants.filter.STARTS_WITH
uiGridConstants.filter.ENDS_WITH
uiGridConstants.filter.CONTAINS
uiGridConstants.filter.GREATER_THAN
uiGridConstants.filter.GREATER_THAN_OR_EQUAL
uiGridConstants.filter.LESS_THAN
uiGridConstants.filter.LESS_THAN_OR_EQUAL
uiGridConstants.filter.NOT_EQUAL
Available type options are:
uiGridConstants.filter.SELECT - use a dropdown box for the cell header filter field
uiGridConstants.filter.INPUT - use a text box for the cell header
filter field

Setting returned text to open an app in applescript

I have a apple script program that I am programming and I want the text the user sends to open an application, But I keep getting error messages saying "Can't get application {"name_of_app"} of <>. The code I very simple and I cant figure out the problem
set deReturnedItems to (display dialog "How many spam messages?" with icon stop default answer "" buttons {"Quit", "OK"} default button 2)
set xpp to text returned of deReturnedItems
set theReturnedItems to (display dialog "How many spam messages?" with icon stop default answer "" buttons {"Quit", "OK"} default button 2)
set amt to the text returned of theReturnedItems
set daReturnedItems to (display dialog "Last thing, what should the spam message say?" default answer "" buttons {"Quit", "OK"} default button 2)
set msg to the text returned of daReturnedItems
repeat [amt] times
tell application [xpp]
activate
tell application "System Events"
keystroke [msg]
keystroke return
end tell
end tell
end repeat
Get rid of those square brackets. Don't use them for variables. Use underscores before and after if you must, like:
repeat _amt_ times
…
end
Also, you need to check to make sure your variable is an integer before you use it in the repeat block.
Incidentally, when you set a variable and then include it in brackets, that's applescript syntax for set the string to a list. For example:
set [x, y, z] to "123"
return x
-- returns "1", and y is set to "2", and z is set to "3"

Issue with using int.parse() in Dart

I'm currently teaching myself the Dart language, and my first app doesn't seem to be working right. Here's the code that's causing trouble:
usrLoc = int.parse(query("#txtLoc").text);
When I try to run the app, it opens fine, but when I click the button that triggers this (and three other similar parses), the debugger stops and tells me "Source not found" for int._native_parse(), int._parse(), and int.parse().
Any help would be greatly appreciated.
The text property for the specified element #txtLoc returns an empty string.
The parse method requires that:
The source must be a non-empty sequence of base- radix digits, optionally prefixed with a minus or plus sign ('-' or '+').
You can specify an onError named argument in your call to parse, which takes a callback that handles the invalid input. E.g., if you want the parse call to return the value 42 for all invalid input, you can do this:
usrLoc = int.parse(query("#txtLoc").text, onError: (val) => 42);
If you really expect the element to have some text, you can store the result of query("#txtLoc").text into a separate variable and verify the value. It would also be interesting to check what the real element type is or which tag is marked with id #txtLoc.
If you want to get the content of an input element, you should use the value property instead of text:
query("#txtLoc").value

Resources