From 8d7c1ae2f6b8f841d28ebea065744808ef7ac205 Mon Sep 17 00:00:00 2001 From: Mike Stall Date: Thu, 22 Feb 2024 09:59:50 -0800 Subject: [PATCH 1/9] fx2nl: more usage hints (#2227) --- .../LanguageServer/IPowerFxScopeFx2NL.cs | 19 ++++++ .../LanguageServer/LanguageServer.cs | 8 ++- .../Public/EditorContextScope.cs | 15 ++++- .../Public/NLHandler.cs | 50 ++++++++++++++ .../LanguageServerTests.cs | 66 +++++++++++++++++++ .../PublicSurfaceTests.cs | 4 ++ 6 files changed, 160 insertions(+), 2 deletions(-) create mode 100644 src/libraries/Microsoft.PowerFx.LanguageServerProtocol/LanguageServer/IPowerFxScopeFx2NL.cs diff --git a/src/libraries/Microsoft.PowerFx.LanguageServerProtocol/LanguageServer/IPowerFxScopeFx2NL.cs b/src/libraries/Microsoft.PowerFx.LanguageServerProtocol/LanguageServer/IPowerFxScopeFx2NL.cs new file mode 100644 index 0000000000..0fb38d03ea --- /dev/null +++ b/src/libraries/Microsoft.PowerFx.LanguageServerProtocol/LanguageServer/IPowerFxScopeFx2NL.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +using System; +using System.Collections.Generic; +using System.Text; +using Microsoft.PowerFx.Intellisense; + +namespace Microsoft.PowerFx.LanguageServerProtocol +{ + /// + /// Additional methods to get Fx2NL context. + /// Hosts should prefer to use EditorContextScope directly. + /// + public interface IPowerFxScopeFx2NL : IPowerFxScope + { + Fx2NLParameters GetFx2NLParameters(); + } +} diff --git a/src/libraries/Microsoft.PowerFx.LanguageServerProtocol/LanguageServer/LanguageServer.cs b/src/libraries/Microsoft.PowerFx.LanguageServerProtocol/LanguageServer/LanguageServer.cs index 8a55a689f8..eb1ee1b0d2 100644 --- a/src/libraries/Microsoft.PowerFx.LanguageServerProtocol/LanguageServer/LanguageServer.cs +++ b/src/libraries/Microsoft.PowerFx.LanguageServerProtocol/LanguageServer/LanguageServer.cs @@ -67,6 +67,7 @@ public class LanguageServer /// If set, provides the handler for $/nlSuggestion message. /// Note: This is not a thread safe. Consider using the NlHandlerFactory. /// + [Obsolete("Use NLHandlerFactory")] public NLHandler NL2FxImplementation { get; set; } /// @@ -557,7 +558,10 @@ protected override CustomFx2NLResult Handle(IPowerFxScope scope, CustomFx2NLPara var check = scope.Check(request.Expression); CancellationToken cancel = default; - var result = nl.Fx2NLAsync(check, cancel) + + var hints = (scope as IPowerFxScopeFx2NL)?.GetFx2NLParameters(); + + var result = nl.Fx2NLAsync(check, hints, cancel) .ConfigureAwait(false).GetAwaiter().GetResult(); return result; } @@ -565,7 +569,9 @@ protected override CustomFx2NLResult Handle(IPowerFxScope scope, CustomFx2NLPara private static NLHandler GetNLHandler(LanguageServer server, IPowerFxScope scope, BaseNLParams nlParams) { +#pragma warning disable CS0618 // Type or member is obsolete return server.NLHandlerFactory?.GetNLHandler(scope, nlParams) ?? server.NL2FxImplementation; +#pragma warning restore CS0618 // Type or member is obsolete } private void HandleCodeActionRequest(string id, string paramsJson) diff --git a/src/libraries/Microsoft.PowerFx.LanguageServerProtocol/Public/EditorContextScope.cs b/src/libraries/Microsoft.PowerFx.LanguageServerProtocol/Public/EditorContextScope.cs index 6819daabbf..796dd59bf9 100644 --- a/src/libraries/Microsoft.PowerFx.LanguageServerProtocol/Public/EditorContextScope.cs +++ b/src/libraries/Microsoft.PowerFx.LanguageServerProtocol/Public/EditorContextScope.cs @@ -6,6 +6,7 @@ using System.Threading; using Microsoft.PowerFx.Core.Utils; using Microsoft.PowerFx.Intellisense; +using Microsoft.PowerFx.LanguageServerProtocol; using Microsoft.PowerFx.LanguageServerProtocol.Protocol; using static Microsoft.PowerFx.LanguageServerProtocol.LanguageServer; @@ -34,7 +35,7 @@ public static EditorContextScope CreateEditorScope( /// A scope is the context for a specific formula bar. /// This includes helpers to aide in customizing the editing experience. /// - public sealed class EditorContextScope : IPowerFxScope + public sealed class EditorContextScope : IPowerFxScope, IPowerFxScopeFx2NL { // List of handlers to get code-fix suggestions. // Key is CodeFixHandler.HandlerName @@ -45,6 +46,10 @@ public sealed class EditorContextScope : IPowerFxScope // This captures the critical invariant: EditorContextScope corresponds to a formula bar where the user just types text, all other context is provided; private readonly Func _getCheckResult; + // Host can set optional hints about where this expression is used. + // This can feed into Fx2NL and other help services. + public UsageHints UsageHints { get; init; } + internal EditorContextScope( Engine engine, ParserOptions parserOptions, @@ -199,5 +204,13 @@ internal void OnCommandExecuted(CodeAction codeAction) handler.OnCodeActionApplied(codeAction.ActionResultContext.ActionIdentifier); } } + + public Fx2NLParameters GetFx2NLParameters() + { + return new Fx2NLParameters + { + UsageHints = this.UsageHints + }; + } } } diff --git a/src/libraries/Microsoft.PowerFx.LanguageServerProtocol/Public/NLHandler.cs b/src/libraries/Microsoft.PowerFx.LanguageServerProtocol/Public/NLHandler.cs index 9cd87a2b95..2190d8a1ae 100644 --- a/src/libraries/Microsoft.PowerFx.LanguageServerProtocol/Public/NLHandler.cs +++ b/src/libraries/Microsoft.PowerFx.LanguageServerProtocol/Public/NLHandler.cs @@ -26,10 +26,18 @@ public virtual Task NL2FxAsync(NL2FxParameters request, Cance throw new NotImplementedException(); } + [Obsolete("Call overload with Fx2NLParameters")] public virtual Task Fx2NLAsync(CheckResult check, CancellationToken cancel) { throw new NotImplementedException(); } + + public virtual async Task Fx2NLAsync(CheckResult check, Fx2NLParameters hints, CancellationToken cancel) + { +#pragma warning disable CS0618 // Type or member is obsolete + return await Fx2NLAsync(check, cancel).ConfigureAwait(false); +#pragma warning restore CS0618 // Type or member is obsolete + } } /// @@ -45,4 +53,46 @@ public class NL2FxParameters // Engine can provide ambient details for NL, such as config and feature flags. public Engine Engine { get; set; } } + + /// + /// Additional context passed from Fx2NL. + /// This should be information that we can't get from a . + /// + public class Fx2NLParameters + { + /// + /// Optional. Additional AppContext about where this expresion is used. + /// + public UsageHints UsageHints { get; set; } + + // we may add additional app context... + } + + /// + /// Additional context that can help explain an expression. + /// This is purely optional and used for heuristics. + /// + public class UsageHints + { + /// + /// Name of control in the document. Eg, "Label1". + /// + public string ControlName { get; set; } + + /// + /// Kind of control, eg "Button", "Gallery", etc. + /// + public string ControlKind { get; set; } + + /// + /// Name of property that this expression is assigned to. + /// + public string PropertyName { get; set; } + + // Many usages can be mapped to control/property. + // Other possible usage locations: + // FieldName. + + public string PropertyDescription { get; set; } + } } diff --git a/src/tests/Microsoft.PowerFx.Interpreter.Tests/LanguageServiceProtocol/LanguageServerTests.cs b/src/tests/Microsoft.PowerFx.Interpreter.Tests/LanguageServiceProtocol/LanguageServerTests.cs index 1b2655d432..efce1ce13f 100644 --- a/src/tests/Microsoft.PowerFx.Interpreter.Tests/LanguageServiceProtocol/LanguageServerTests.cs +++ b/src/tests/Microsoft.PowerFx.Interpreter.Tests/LanguageServiceProtocol/LanguageServerTests.cs @@ -1601,7 +1601,9 @@ public override async Task NL2FxAsync(NL2FxParameters request }; } +#pragma warning disable CS0672 // Member overrides obsolete member public override async Task Fx2NLAsync(CheckResult check, CancellationToken cancel) +#pragma warning restore CS0672 // Member overrides obsolete member { if (this.Throw) { @@ -1622,6 +1624,26 @@ public override async Task Fx2NLAsync(CheckResult check, Canc } } + // Test the overload with Fx2NLParameters + private class TestNLHandler2 : TestNLHandler + { + public override async Task Fx2NLAsync(CheckResult check, Fx2NLParameters hints, CancellationToken cancel) + { + var sb = new StringBuilder(); + sb.Append(hints?.UsageHints?.ControlName); + sb.Append("; "); + sb.Append(hints?.UsageHints?.ControlKind); + + sb.Append("; "); + sb.Append(hints?.UsageHints?.PropertyName); + + return new CustomFx2NLResult + { + Explanation = sb.ToString() + }; + } + } + private static string NL2FxMessageJson(string documentUri) { return JsonSerializer.Serialize(new @@ -1705,10 +1727,12 @@ public void TestNL2FX(string expectedExpr, bool success, bool useFactory) var scopeFactory = new TestPowerFxScopeFactory((string documentUri) => dict[documentUri]); var testNLHandler = new TestNLHandler { Expected = expectedExpr }; +#pragma warning disable CS0618 // Type or member is obsolete var testServer = useFactory ? new TestLanguageServer(_output, _sendToClientData.Add, scopeFactory, new TestNlHandlerFactory(testNLHandler)) : new TestLanguageServer(_output, _sendToClientData.Add, scopeFactory) { NL2FxImplementation = testNLHandler }; +#pragma warning restore CS0618 // Type or member is obsolete List exList = new List(); testServer.LogUnhandledExceptionHandler += (Exception ex) => exList.Add(ex); @@ -1754,7 +1778,9 @@ public void TestNL2FXMissingHandler() var testServer = new TestLanguageServer(_output, _sendToClientData.Add, scopeFactory); // No handler registered +#pragma warning disable CS0618 // Type or member is obsolete Assert.Null(testServer.NL2FxImplementation); +#pragma warning restore CS0618 // Type or member is obsolete List exList = new List(); testServer.LogUnhandledExceptionHandler += (Exception ex) => exList.Add(ex); @@ -1875,6 +1901,46 @@ public void TestFx2NL() Assert.Equal("Score > 3: True: sentence", response.Result.Explanation); } + [Fact] + public void TestFx2NLUsageHints() + { + var documentUri = "powerfx://app?context=1"; + var expectedExpr = "sentence"; + + var engine = new Engine(); + var symbols = new SymbolTable(); + symbols.AddVariable("Score", FormulaType.Number); + var editor = new EditorContextScope(engine, null, symbols) + { + UsageHints = new UsageHints + { + ControlKind = "Button", + ControlName = "MyButton", + PropertyName = "Select" + } + }; + + var dict = new Dictionary + { + { documentUri, editor } + }; + var scopeFactory = new TestPowerFxScopeFactory((string documentUri) => dict[documentUri]); + + var testNLHandler = new TestNLHandler2 { Expected = expectedExpr }; + var testServer = new TestLanguageServer(_output, _sendToClientData.Add, scopeFactory, new TestNlHandlerFactory(testNLHandler)); + + List exList = new List(); + testServer.LogUnhandledExceptionHandler += (Exception ex) => exList.Add(ex); + + testServer.OnDataReceived(FX2NlMessageJson(documentUri)); + Assert.Single(_sendToClientData); + var response = JsonSerializer.Deserialize(_sendToClientData[0], _jsonSerializerOptions); + Assert.Equal("123", response.Id); + + // result has expected concat with symbols. + Assert.Equal("MyButton; Button; Select", response.Result.Explanation); + } + [Fact] public void ErrorIsLocalized() { diff --git a/src/tests/Microsoft.PowerFx.Interpreter.Tests/LanguageServiceProtocol/PublicSurfaceTests.cs b/src/tests/Microsoft.PowerFx.Interpreter.Tests/LanguageServiceProtocol/PublicSurfaceTests.cs index 9c7efdc34b..6d8cdb07a7 100644 --- a/src/tests/Microsoft.PowerFx.Interpreter.Tests/LanguageServiceProtocol/PublicSurfaceTests.cs +++ b/src/tests/Microsoft.PowerFx.Interpreter.Tests/LanguageServiceProtocol/PublicSurfaceTests.cs @@ -34,9 +34,13 @@ public void Test() "Microsoft.PowerFx.LanguageServerProtocol.LanguageServer", + // NL features. "Microsoft.PowerFx.LanguageServerProtocol.NLHandler", "Microsoft.PowerFx.LanguageServerProtocol.NL2FxParameters", "Microsoft.PowerFx.LanguageServerProtocol.INLHandlerFactory", + "Microsoft.PowerFx.LanguageServerProtocol.IPowerFxScopeFx2NL", + "Microsoft.PowerFx.LanguageServerProtocol.Fx2NLParameters", + "Microsoft.PowerFx.LanguageServerProtocol.UsageHints", // Internal "Microsoft.PowerFx.LanguageServerProtocol.JsonRpcHelper", From aae67651b0c526f408d7036b816a527570a3527c Mon Sep 17 00:00:00 2001 From: Luc Genetier <69138830+LucGenetier@users.noreply.github.com> Date: Fri, 23 Feb 2024 15:45:49 +0100 Subject: [PATCH 2/9] Give access to another NL assembly (#2233) --- src/libraries/Microsoft.PowerFx.Core/AssemblyProperties.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/Microsoft.PowerFx.Core/AssemblyProperties.cs b/src/libraries/Microsoft.PowerFx.Core/AssemblyProperties.cs index 3c529e8951..5b2f400237 100644 --- a/src/libraries/Microsoft.PowerFx.Core/AssemblyProperties.cs +++ b/src/libraries/Microsoft.PowerFx.Core/AssemblyProperties.cs @@ -52,5 +52,6 @@ // NL [assembly: InternalsVisibleTo("Microsoft.PowerFx.NaturalLanguage, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] +[assembly: InternalsVisibleTo("Microsoft.PowerFx.NLEngine, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] [assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] From e26195c2508823afc5269a43c6f3928588a0fa2f Mon Sep 17 00:00:00 2001 From: Luc Genetier <69138830+LucGenetier@users.noreply.github.com> Date: Fri, 23 Feb 2024 19:07:05 +0100 Subject: [PATCH 3/9] Fix pretty print for tables (#2232) --- .../Microsoft.PowerFx.Core/Syntax/TexlPretty.cs | 10 +++++----- .../Microsoft.PowerFx.Core.Tests/TexlTests.cs | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/libraries/Microsoft.PowerFx.Core/Syntax/TexlPretty.cs b/src/libraries/Microsoft.PowerFx.Core/Syntax/TexlPretty.cs index b66d8ff9d7..1249da7f0a 100644 --- a/src/libraries/Microsoft.PowerFx.Core/Syntax/TexlPretty.cs +++ b/src/libraries/Microsoft.PowerFx.Core/Syntax/TexlPretty.cs @@ -67,8 +67,8 @@ public override LazyList Visit(NumLitNode node, Precedence parentPrecede Contracts.AssertValue(node); var nlt = node.Value; - - // $$$ can't use current culture + + // $$$ can't use current culture return LazyList.Of(nlt != null ? nlt.ToString() : node.NumValue.ToString("R", CultureInfo.CurrentCulture)); } @@ -77,7 +77,7 @@ public override LazyList Visit(DecLitNode node, Precedence parentPrecede Contracts.AssertValue(node); var nlt = node.Value; - + // $$$ can't use current culture return LazyList.Of(nlt != null ? nlt.ToString() : node.DecValue.ToString("G29", CultureInfo.CurrentCulture)); } @@ -399,8 +399,8 @@ public override LazyList Visit(TableNode node, Precedence parentPreceden result = LazyList.Of(TexlLexer.PunctuatorBracketOpen, " ") .With(result) .With(" ", TexlLexer.PunctuatorBracketClose); - - return ApplyPrecedence(parentPrecedence, Precedence.SingleExpr, result); + + return result; } public virtual string GetRightToken(TexlNode leftNode, Identifier right) diff --git a/src/tests/Microsoft.PowerFx.Core.Tests/TexlTests.cs b/src/tests/Microsoft.PowerFx.Core.Tests/TexlTests.cs index 41dd902850..a93f1230b7 100644 --- a/src/tests/Microsoft.PowerFx.Core.Tests/TexlTests.cs +++ b/src/tests/Microsoft.PowerFx.Core.Tests/TexlTests.cs @@ -4083,6 +4083,21 @@ public void TexlFunctionTypeSemanticColumn_Negative(string expression) Assert.False(result.IsSuccess); } + [Theory] + [InlineData("in")] + [InlineData("exactin")] + public void PrettyPrintTest(string op) + { + string expr = $"1 {op} [0]"; + + CheckResult check = new CheckResult(new Engine()).SetText(expr); + ParseResult parse = check.ApplyParse(); + + string str = parse.Root.ToString(); + + Assert.Equal($"1 {op} [ 0 ]", str); + } + internal class BlobFunc : TexlFunction { public override bool IsSelfContained => false; From 1064cd8a92ddfd5db3389804036cbae2c58200ac Mon Sep 17 00:00:00 2001 From: Greg Lindhorst Date: Fri, 23 Feb 2024 12:48:02 -0800 Subject: [PATCH 4/9] Value and Boolean function support for number and Boolean backed Option Sets (#2230) --- .../Localization/Strings.cs | 10 ++ .../Texl/BuiltinFunctionsCore.cs | 6 +- .../Texl/Builtins/Boolean.cs | 113 +++++++++++++++-- .../Texl/Builtins/Value.cs | 3 +- .../Microsoft.PowerFx.Core/Types/DType.cs | 6 + .../Functions/Library.cs | 15 +++ .../Functions/LibraryText.cs | 28 +++- src/strings/PowerFxResources.en-US.resx | 44 +++++++ .../IntellisenseTests/TestSignatures/11.json | 28 +++- .../RecalcEngineTests.cs | 120 ++++++++++++++++++ 10 files changed, 356 insertions(+), 17 deletions(-) diff --git a/src/libraries/Microsoft.PowerFx.Core/Localization/Strings.cs b/src/libraries/Microsoft.PowerFx.Core/Localization/Strings.cs index 84053bc761..c0a88e775b 100644 --- a/src/libraries/Microsoft.PowerFx.Core/Localization/Strings.cs +++ b/src/libraries/Microsoft.PowerFx.Core/Localization/Strings.cs @@ -106,11 +106,21 @@ internal static class TexlStrings public static StringGetter AboutBooleanNT = (b) => StringResources.Get("AboutBooleanNT", b); public static StringGetter BooleanNTArg1 = (b) => StringResources.Get("BooleanNTArg1", b); + public static StringGetter AboutBooleanW = (b) => StringResources.Get("AboutBooleanW", b); + public static StringGetter BooleanWArg1 = (b) => StringResources.Get("BooleanWArg1", b); + public static StringGetter AboutBooleanWT = (b) => StringResources.Get("AboutBooleanWT", b); + public static StringGetter BooleanWTArg1 = (b) => StringResources.Get("BooleanWTArg1", b); + public static StringGetter AboutBooleanB = (b) => StringResources.Get("AboutBooleanB", b); public static StringGetter BooleanBArg1 = (b) => StringResources.Get("BooleanBArg1", b); public static StringGetter AboutBooleanBT = (b) => StringResources.Get("AboutBooleanBT", b); public static StringGetter BooleanBTArg1 = (b) => StringResources.Get("BooleanBTArg1", b); + public static StringGetter AboutBooleanL = (b) => StringResources.Get("AboutBooleanL", b); + public static StringGetter BooleanLArg1 = (b) => StringResources.Get("BooleanLArg1", b); + public static StringGetter AboutBooleanLT = (b) => StringResources.Get("AboutBooleanLT", b); + public static StringGetter BooleanLTArg1 = (b) => StringResources.Get("BooleanLTArg1", b); + public static StringGetter AboutConcatenate = (b) => StringResources.Get("AboutConcatenate", b); public static StringGetter ConcatenateArg1 = (b) => StringResources.Get("ConcatenateArg1", b); public static StringGetter AboutConcatenateT = (b) => StringResources.Get("AboutConcatenateT", b); diff --git a/src/libraries/Microsoft.PowerFx.Core/Texl/BuiltinFunctionsCore.cs b/src/libraries/Microsoft.PowerFx.Core/Texl/BuiltinFunctionsCore.cs index 3390b8b9e6..54198afa89 100644 --- a/src/libraries/Microsoft.PowerFx.Core/Texl/BuiltinFunctionsCore.cs +++ b/src/libraries/Microsoft.PowerFx.Core/Texl/BuiltinFunctionsCore.cs @@ -55,7 +55,7 @@ internal class BuiltinFunctionsCore public static readonly TexlFunction BooleanN = _library.Add(new BooleanNFunction()); public static readonly TexlFunction BooleanN_T = _library.Add(new BooleanNFunction_T()); public static readonly TexlFunction BooleanW = _library.Add(new BooleanWFunction()); - public static readonly TexlFunction BooleanW_T = _library.Add(new BooleanWFunction_T()); + public static readonly TexlFunction BooleanW_T = _library.Add(new BooleanWFunction_T()); public static readonly TexlFunction Char = _library.Add(new CharFunction()); public static readonly TexlFunction CharT = _library.Add(new CharTFunction()); public static readonly TexlFunction Clock24 = _library.Add(new IsClock24Function()); @@ -255,7 +255,9 @@ internal class BuiltinFunctionsCore public static readonly TexlFunction IsUTCToday = _featureGateFunctions.Add(new IsUTCTodayFunction()); public static readonly TexlFunction OptionsSetInfo = _featureGateFunctions.Add(new OptionSetInfoFunction()); public static readonly TexlFunction UTCNow = _featureGateFunctions.Add(new UTCNowFunction()); - public static readonly TexlFunction UTCToday = _featureGateFunctions.Add(new UTCTodayFunction()); + public static readonly TexlFunction UTCToday = _featureGateFunctions.Add(new UTCTodayFunction()); + public static readonly TexlFunction BooleanL = _featureGateFunctions.Add(new BooleanLFunction()); + public static readonly TexlFunction BooleanL_T = _featureGateFunctions.Add(new BooleanLFunction_T()); // Slow API, only use for backward compatibility #pragma warning disable CS0618 // Type or member is obsolete diff --git a/src/libraries/Microsoft.PowerFx.Core/Texl/Builtins/Boolean.cs b/src/libraries/Microsoft.PowerFx.Core/Texl/Builtins/Boolean.cs index a2b93b61f7..4bd18caf88 100644 --- a/src/libraries/Microsoft.PowerFx.Core/Texl/Builtins/Boolean.cs +++ b/src/libraries/Microsoft.PowerFx.Core/Texl/Builtins/Boolean.cs @@ -12,6 +12,7 @@ using Microsoft.PowerFx.Core.Localization; using Microsoft.PowerFx.Core.Types; using Microsoft.PowerFx.Core.Utils; +using Microsoft.PowerFx.Functions; using Microsoft.PowerFx.Syntax; #pragma warning disable SA1402 // File may only contain a single type @@ -158,21 +159,21 @@ internal sealed class BooleanWFunction : BuiltinFunction // Reusing BooleanN strings as they are generic for numbers public BooleanWFunction() - : base(BooleanFunction.BooleanInvariantFunctionName, TexlStrings.AboutBooleanN, FunctionCategories.Text, DType.Boolean, 0, 1, 1, DType.Decimal) + : base(BooleanFunction.BooleanInvariantFunctionName, TexlStrings.AboutBooleanW, FunctionCategories.Text, DType.Boolean, 0, 1, 1, DType.Decimal) { } public override IEnumerable GetSignatures() { // Reusing BooleanN strings as they are generic for numbers - yield return new[] { TexlStrings.BooleanNArg1 }; + yield return new[] { TexlStrings.BooleanWArg1 }; } public override bool TryGetParamDescription(string paramName, out string paramDescription) { Contracts.AssertNonEmpty(paramName); - return StringResources.TryGet("AboutBooleanN_" + paramName, out paramDescription); + return StringResources.TryGet("AboutBooleanW_" + paramName, out paramDescription); } } @@ -186,14 +187,14 @@ internal sealed class BooleanWFunction_T : BuiltinFunction // Reusing BooleanN strings as they are generic for numbers public BooleanWFunction_T() - : base(BooleanFunction.BooleanInvariantFunctionName, TexlStrings.AboutBooleanNT, FunctionCategories.Table, DType.EmptyTable, 0, 1, 1, DType.EmptyTable) + : base(BooleanFunction.BooleanInvariantFunctionName, TexlStrings.AboutBooleanWT, FunctionCategories.Table, DType.EmptyTable, 0, 1, 1, DType.EmptyTable) { } public override IEnumerable GetSignatures() { // Reusing BooleanN strings as they are generic for numbers - yield return new[] { TexlStrings.BooleanNTArg1 }; + yield return new[] { TexlStrings.BooleanWTArg1 }; } public override bool CheckTypes(CheckTypesContext context, TexlNode[] args, DType[] argTypes, IErrorContainer errors, out DType returnType, out Dictionary nodeToCoercedTypeMap) @@ -216,7 +217,7 @@ public override bool TryGetParamDescription(string paramName, out string paramDe Contracts.AssertNonEmpty(paramName); // Reusing BooleanN strings as they are generic for numbers - return StringResources.TryGet("AboutBooleanNT_" + paramName, out paramDescription); + return StringResources.TryGet("AboutBooleanWT_" + paramName, out paramDescription); } } @@ -229,13 +230,21 @@ internal sealed class BooleanBFunction : BuiltinFunction public override bool SupportsParamCoercion => false; public BooleanBFunction() - : base(BooleanFunction.BooleanInvariantFunctionName, TexlStrings.AboutBooleanN, FunctionCategories.Text, DType.Boolean, 0, 1, 1, DType.Boolean) + : base(BooleanFunction.BooleanInvariantFunctionName, TexlStrings.AboutBooleanB, FunctionCategories.Text, DType.Boolean, 0, 1, 1, DType.Boolean) { } public override IEnumerable GetSignatures() { - yield return new[] { TexlStrings.BooleanArg1 }; + yield return new[] { TexlStrings.BooleanBArg1 }; + } + + public override bool TryGetParamDescription(string paramName, out string paramDescription) + { + Contracts.AssertNonEmpty(paramName); + + // Reusing BooleanN strings as they are generic for numbers + return StringResources.TryGet("AboutBooleanB_" + paramName, out paramDescription); } /// @@ -269,7 +278,7 @@ public BooleanBFunction_T() public override IEnumerable GetSignatures() { - yield return new[] { TexlStrings.BooleanNTArg1 }; + yield return new[] { TexlStrings.BooleanBTArg1 }; } public override bool CheckTypes(CheckTypesContext context, TexlNode[] args, DType[] argTypes, IErrorContainer errors, out DType returnType, out Dictionary nodeToCoercedTypeMap) @@ -312,6 +321,92 @@ internal override IR.Nodes.IntermediateNode CreateIRCallNode(PowerFx.Syntax.Call return base.CreateIRCallNode(node, context, args, scope); } } + } + + // Boolean(arg:L) + // Corresponding Excel and DAX function: Boolean + internal sealed class BooleanLFunction : BuiltinFunction + { + public override bool IsSelfContained => true; + + public override bool SupportsParamCoercion => false; + + public BooleanLFunction() + : base(BooleanFunction.BooleanInvariantFunctionName, TexlStrings.AboutBooleanL, FunctionCategories.Text, DType.Boolean, 0, 1, 1, DType.OptionSetValue) + { + } + + public override IEnumerable GetSignatures() + { + yield return new[] { TexlStrings.BooleanLArg1 }; + } + + public override bool CheckTypes(CheckTypesContext context, TexlNode[] args, DType[] argTypes, IErrorContainer errors, out DType returnType, out Dictionary nodeToCoercedTypeMap) + { + var argType = argTypes[0]; + + var fValid = base.CheckTypes(context, args, argTypes, errors, out returnType, out nodeToCoercedTypeMap) && + argType.IsOptionSetBackedByBoolean; + + returnType = DType.Boolean; + + return fValid; + } + + public override bool TryGetParamDescription(string paramName, out string paramDescription) + { + Contracts.AssertNonEmpty(paramName); + + return StringResources.TryGet("AboutBooleanL_" + paramName, out paramDescription); + } + } + + // Boolean(E:*[L]) + // Corresponding Excel and DAX function: Boolean + internal sealed class BooleanLFunction_T : BuiltinFunction + { + public override bool IsSelfContained => true; + + public override bool SupportsParamCoercion => false; + + public BooleanLFunction_T() + : base(BooleanFunction.BooleanInvariantFunctionName, TexlStrings.AboutBooleanLT, FunctionCategories.Table, DType.EmptyTable, 0, 1, 1, DType.EmptyTable) + { + } + + public override IEnumerable GetSignatures() + { + yield return new[] { TexlStrings.BooleanLTArg1 }; + } + + public override bool CheckTypes(CheckTypesContext context, TexlNode[] args, DType[] argTypes, IErrorContainer errors, out DType returnType, out Dictionary nodeToCoercedTypeMap) + { + var fValid = base.CheckTypes(context, args, argTypes, errors, out returnType, out nodeToCoercedTypeMap); + Contracts.Assert(returnType.IsTable); + + var arg = args[0]; + var argType = argTypes[0]; + + // Check first that it is a single column table of option set values. + // Next check that the column is not only option sets, but also backed by Booleans. + if (CheckColumnType(context, arg, argType, DType.OptionSetValue, errors, ref nodeToCoercedTypeMap) && + argType.TypeTree.GetPairs().First().Value.IsOptionSetBackedByBoolean) + { + var rowType = DType.EmptyRecord.Add(new TypedName(DType.Boolean, ColumnName_Value)); + returnType = rowType.ToTable(); + + return true; + } + + return false; + } + + public override bool TryGetParamDescription(string paramName, out string paramDescription) + { + Contracts.AssertNonEmpty(paramName); + + return StringResources.TryGet("AboutBooleanLT_" + paramName, out paramDescription); + } } // Boolean(arg:O) diff --git a/src/libraries/Microsoft.PowerFx.Core/Texl/Builtins/Value.cs b/src/libraries/Microsoft.PowerFx.Core/Texl/Builtins/Value.cs index 5e9454d748..b608acfa64 100644 --- a/src/libraries/Microsoft.PowerFx.Core/Texl/Builtins/Value.cs +++ b/src/libraries/Microsoft.PowerFx.Core/Texl/Builtins/Value.cs @@ -46,7 +46,8 @@ public override bool CheckTypes(CheckTypesContext context, TexlNode[] args, DTyp if (!DType.Number.Accepts(argType, exact: true, useLegacyDateTimeAccepts: false, usePowerFxV1CompatibilityRules: context.Features.PowerFxV1CompatibilityRules) && !DType.Decimal.Accepts(argType, exact: true, useLegacyDateTimeAccepts: false, usePowerFxV1CompatibilityRules: context.Features.PowerFxV1CompatibilityRules) && !DType.String.Accepts(argType, exact: true, useLegacyDateTimeAccepts: false, usePowerFxV1CompatibilityRules: context.Features.PowerFxV1CompatibilityRules) && - !DType.Boolean.Accepts(argType, exact: true, useLegacyDateTimeAccepts: false, usePowerFxV1CompatibilityRules: context.Features.PowerFxV1CompatibilityRules)) + !DType.Boolean.Accepts(argType, exact: true, useLegacyDateTimeAccepts: false, usePowerFxV1CompatibilityRules: context.Features.PowerFxV1CompatibilityRules) && + !argType.IsOptionSetBackedByNumber) { if (argType.CoercesTo(DType.DateTime, aggregateCoercion: true, isTopLevelCoercion: false, context.Features) && !argType.IsControl) { diff --git a/src/libraries/Microsoft.PowerFx.Core/Types/DType.cs b/src/libraries/Microsoft.PowerFx.Core/Types/DType.cs index a4ef4f77ff..6d9db7c2cf 100644 --- a/src/libraries/Microsoft.PowerFx.Core/Types/DType.cs +++ b/src/libraries/Microsoft.PowerFx.Core/Types/DType.cs @@ -598,6 +598,12 @@ internal void AssertValid() public bool IsOptionSet => Kind == DKind.OptionSet || Kind == DKind.OptionSetValue; + public bool IsOptionSetBackedByNumber => IsOptionSet && OptionSetInfo.BackingKind == DKind.Number; + + public bool IsOptionSetBackedByBoolean => IsOptionSet && OptionSetInfo.BackingKind == DKind.Boolean; + + public bool IsOptionSetBackedByColor => IsOptionSet && OptionSetInfo.BackingKind == DKind.Color; + public bool IsView => Kind == DKind.View || Kind == DKind.ViewValue; public bool IsAggregate => IsRecord || IsTable; diff --git a/src/libraries/Microsoft.PowerFx.Interpreter/Functions/Library.cs b/src/libraries/Microsoft.PowerFx.Interpreter/Functions/Library.cs index bed0896be9..d4c9364620 100644 --- a/src/libraries/Microsoft.PowerFx.Interpreter/Functions/Library.cs +++ b/src/libraries/Microsoft.PowerFx.Interpreter/Functions/Library.cs @@ -225,6 +225,17 @@ static Library() returnBehavior: ReturnBehavior.ReturnBlankIfAnyArgIsBlank, targetFunction: DecimalToBoolean) }, + { + BuiltinFunctionsCore.BooleanL, + StandardErrorHandling( + BuiltinFunctionsCore.BooleanL.Name, + expandArguments: NoArgExpansion, + replaceBlankValues: DoNotReplaceBlank, + checkRuntimeTypes: ExactValueTypeOrBlank, + checkRuntimeValues: DeferRuntimeValueChecking, + returnBehavior: ReturnBehavior.ReturnBlankIfAnyArgIsBlank, + targetFunction: BooleanOptionSetToBoolean) + }, // This implementation is not actually used for this as this is handled at IR level. // This is a placeholder, so that RecalcEngine._interpreterSupportedFunctions can add it for txt tests. @@ -1909,6 +1920,10 @@ static Library() BuiltinFunctionsCore.BooleanW_T, StandardErrorHandlingTabularOverload(BuiltinFunctionsCore.BooleanW_T.Name, SimpleFunctionImplementations[BuiltinFunctionsCore.BooleanW], DoNotReplaceBlank) }, + { + BuiltinFunctionsCore.BooleanL_T, + StandardErrorHandlingTabularOverload(BuiltinFunctionsCore.BooleanL_T.Name, SimpleFunctionImplementations[BuiltinFunctionsCore.BooleanL], DoNotReplaceBlank) + }, // This implementation is not actually used for this as this is handled at IR level. // This is a placeholder, so that RecalcEngine._interpreterSupportedFunctions can add it for txt tests. diff --git a/src/libraries/Microsoft.PowerFx.Interpreter/Functions/LibraryText.cs b/src/libraries/Microsoft.PowerFx.Interpreter/Functions/LibraryText.cs index d539992970..441853da85 100644 --- a/src/libraries/Microsoft.PowerFx.Interpreter/Functions/LibraryText.cs +++ b/src/libraries/Microsoft.PowerFx.Interpreter/Functions/LibraryText.cs @@ -201,6 +201,9 @@ public static bool TryFloat(FormattingInfo formatInfo, IRContext irContext, Form case BooleanValue b: result = BooleanToNumber(irContext, b); break; + case OptionSetValue osv: + result = new NumberValue(irContext, (double)osv.ExecutionValue); + break; case DateValue dv: result = DateToNumber(formatInfo, irContext, dv); break; @@ -261,7 +264,7 @@ public static bool TryDecimal(FormattingInfo formatInfo, IRContext irContext, Fo { result = null; - Contract.Assert(DecimalValue.AllowedListConvertToDecimal.Contains(value.Type)); + Contract.Assert(DecimalValue.AllowedListConvertToDecimal.Contains(value.Type) || value.Type._type.IsOptionSetBackedByNumber); switch (value) { @@ -284,6 +287,21 @@ public static bool TryDecimal(FormattingInfo formatInfo, IRContext irContext, Fo break; case DateTimeValue dtv: result = DateTimeToDecimal(formatInfo, irContext, dtv); + break; + case OptionSetValue osv: + if (value.Type._type.IsOptionSetBackedByNumber) + { + var (os, osErr) = ConvertNumberToDecimal((double)osv.ExecutionValue); + if (osErr == ConvertionStatus.Ok) + { + result = new DecimalValue(irContext, os); + } + } + else + { + result = new DecimalValue(irContext, (decimal)osv.ExecutionValue); + } + break; case StringValue sv: var (str, strErr) = ConvertToDecimal(sv.Value, formatInfo.CultureInfo); @@ -624,6 +642,14 @@ private static string ResolveDateTimeFormatAmbiguities(string format, DateTime d return resultString; } + public static BooleanValue BooleanOptionSetToBoolean(IRContext irContext, OptionSetValue[] args) + { + Contract.Assert(args[0].Type._type.IsOptionSetBackedByBoolean); + + var n = args[0].ExecutionValue; + return new BooleanValue(irContext, (bool)n); + } + private static string RestoreDoubleQuotedStrings(string format, List replaceList, CancellationToken cancellationToken) { var stringReplaceRegex = new Regex("\u0011"); diff --git a/src/strings/PowerFxResources.en-US.resx b/src/strings/PowerFxResources.en-US.resx index ee6e0a2268..d1a385b128 100644 --- a/src/strings/PowerFxResources.en-US.resx +++ b/src/strings/PowerFxResources.en-US.resx @@ -581,6 +581,50 @@ A column of boolean values to process. + + Converts a decimal number to a boolean value. + Description of 'Boolean' function. + + + number + function_parameter - First argument to the Boolean function - the decimal number that will be converted to a boolean. + + + The decimal number value to convert to a boolean value. + + + Converts a column of decimal numeric values to a column of boolean values. + Description of 'Boolean' function. + + + input + function_parameter - First argument to the Boolean function - a column of decimal number values. + + + A column of number values to process. + + + Converts a choice value backed by a boolean to a boolean value. + Description of 'Boolean' function. + + + choice + function_parameter - First argument to the Boolean function - the choice value that will be converted to a boolean. + + + The choice to convert to a boolean value. + + + Converts a column of choice values backed by booleans to a column of boolean values. + Description of 'Boolean' function. + + + input + function_parameter - First argument to the Boolean function - a column of choice values. + + + A column of choice values to process. + Returns the first non blank argument Description of 'Coalesce' function. diff --git a/src/tests/Microsoft.PowerFx.Core.Tests/IntellisenseTests/TestSignatures/11.json b/src/tests/Microsoft.PowerFx.Core.Tests/IntellisenseTests/TestSignatures/11.json index 6038d16cbc..89033fd286 100644 --- a/src/tests/Microsoft.PowerFx.Core.Tests/IntellisenseTests/TestSignatures/11.json +++ b/src/tests/Microsoft.PowerFx.Core.Tests/IntellisenseTests/TestSignatures/11.json @@ -21,12 +21,12 @@ ] }, { - "Label": "Boolean(text)", - "Documentation": "Converts a 'number' to a boolean value.", + "Label": "Boolean(boolean)", + "Documentation": "Converts a 'boolean' to a boolean value.", "Parameters": [ { - "Label": "text", - "Documentation": "The text value to convert to a boolean value." + "Label": "boolean", + "Documentation": "" } ] }, @@ -59,6 +59,26 @@ "Documentation": "" } ] + }, + { + "Label": "Boolean(number)", + "Documentation": "Converts a decimal number to a boolean value.", + "Parameters": [ + { + "Label": "number", + "Documentation": "" + } + ] + }, + { + "Label": "Boolean(input)", + "Documentation": "Converts a column of decimal numeric values to a column of boolean values.", + "Parameters": [ + { + "Label": "input", + "Documentation": "" + } + ] } ], "ActiveSignature": 0, diff --git a/src/tests/Microsoft.PowerFx.Interpreter.Tests/RecalcEngineTests.cs b/src/tests/Microsoft.PowerFx.Interpreter.Tests/RecalcEngineTests.cs index 2f451cb077..4502e0e8eb 100644 --- a/src/tests/Microsoft.PowerFx.Interpreter.Tests/RecalcEngineTests.cs +++ b/src/tests/Microsoft.PowerFx.Interpreter.Tests/RecalcEngineTests.cs @@ -1113,6 +1113,126 @@ public void EmptyEnumStoreTest() Assert.IsType(checkResult.ReturnType); } + [Theory] + [InlineData("Text(TestEnum.Choice1)", true)] + [InlineData("\"Label: \" & TestEnum.Choice1", true)] + [InlineData("Value(TestEnum.Choice1)", false)] + [InlineData("TestEnum.Choice1 + 1", false)] + [InlineData("Decimal(TestEnum.Choice1)", false)] + [InlineData("Float(TestEnum.Choice1)", false)] + [InlineData("Boolean(TestEnum.Choice1)", false)] + [InlineData("Boolean([TestEnum.Choice1,TestEnum.Choice2])", false)] + [InlineData("TestEnum.Choice1 And true", false)] + [InlineData("ColorFade(TestEnum.Choice1,10%)", false)] + [InlineData("ColorFade([TestEnum.Choice1,TestEnum.Choice2],10%)", false)] + public void OptionSetBackingTextTests(string expression, bool valid) + { + var enumStoreBuilder = new EnumStoreBuilder(); + enumStoreBuilder.TestOnly_WithCustomEnum(new EnumSymbol( + new DName("TestEnum"), + DType.String, + new Dictionary() + { + { "Choice1", "Choice_1" }, + { "Choice2", "Choice_2" }, + })); + var config = PowerFxConfig.BuildWithEnumStore(enumStoreBuilder, features: Features.PowerFxV1); + var recalcEngine = new RecalcEngine(config); + + var checkResult = recalcEngine.Check(expression, RecordType.Empty()); + Assert.Equal(valid, checkResult.IsSuccess); + } + + [Theory] + [InlineData("Text(TestEnum.Choice1)", true)] + [InlineData("\"Label: \" & TestEnum.Choice1", true)] + [InlineData("Value(TestEnum.Choice1)", true)] + [InlineData("TestEnum.Choice1 + 1", false)] // see https://github.com/microsoft/Power-Fx/issues/2229 + [InlineData("Decimal(TestEnum.Choice1)", true)] + [InlineData("Float(TestEnum.Choice1)", true)] + [InlineData("Boolean(TestEnum.Choice1)", false)] + [InlineData("Boolean([TestEnum.Choice1,TestEnum.Choice2])", false)] + [InlineData("TestEnum.Choice1 And true", false)] + [InlineData("ColorFade(TestEnum.Choice1,10%)", false)] + [InlineData("ColorFade([TestEnum.Choice1,TestEnum.Choice2],10%)", false)] + public void OptionSetBackingNumberTests(string expression, bool valid) + { + var enumStoreBuilder = new EnumStoreBuilder(); + enumStoreBuilder.TestOnly_WithCustomEnum(new EnumSymbol( + new DName("TestEnum"), + DType.Number, + new Dictionary() + { + { "Choice1", 1 }, + { "Choice2", 2 }, + })); + var config = PowerFxConfig.BuildWithEnumStore(enumStoreBuilder, features: Features.PowerFxV1); + var recalcEngine = new RecalcEngine(config); + + var checkResult = recalcEngine.Check(expression, RecordType.Empty()); + Assert.Equal(valid, checkResult.IsSuccess); + } + + [Theory] + [InlineData("Text(TestEnum.Choice1)", true)] + [InlineData("\"Label: \" & TestEnum.Choice1", true)] + [InlineData("Value(TestEnum.Choice1)", false)] + [InlineData("TestEnum.Choice1 + 1", false)] + [InlineData("Decimal(TestEnum.Choice1)", false)] + [InlineData("Float(TestEnum.Choice1)", false)] + [InlineData("Boolean(TestEnum.Choice1)", true)] + [InlineData("Boolean([TestEnum.Choice1,TestEnum.Choice2])", true)] + [InlineData("TestEnum.Choice1 And true", true)] + [InlineData("ColorFade(TestEnum.Choice1,10%)", false)] + [InlineData("ColorFade([TestEnum.Choice1,TestEnum.Choice2],10%)", false)] + public void OptionSetBackingBooleanTests(string expression, bool valid) + { + var enumStoreBuilder = new EnumStoreBuilder(); + enumStoreBuilder.TestOnly_WithCustomEnum(new EnumSymbol( + new DName("TestEnum"), + DType.Boolean, + new Dictionary() + { + { "Choice1", true }, + { "Choice2", false }, + })); + var config = PowerFxConfig.BuildWithEnumStore(enumStoreBuilder, features: Features.PowerFxV1); + var recalcEngine = new RecalcEngine(config); + + var checkResult = recalcEngine.Check(expression, RecordType.Empty()); + Assert.Equal(valid, checkResult.IsSuccess); + } + + [Theory] + [InlineData("Text(TestEnum.Choice1)", true)] + [InlineData("\"Label: \" & TestEnum.Choice1", true)] + [InlineData("Value(TestEnum.Choice1)", false)] + [InlineData("TestEnum.Choice1 + 1", false)] + [InlineData("Decimal(TestEnum.Choice1)", false)] + [InlineData("Float(TestEnum.Choice1)", false)] + [InlineData("Boolean(TestEnum.Choice1)", false)] + [InlineData("Boolean([TestEnum.Choice1,TestEnum.Choice2])", false)] + [InlineData("TestEnum.Choice1 And true", false)] + [InlineData("ColorFade(TestEnum.Choice1,10%)", true)] + [InlineData("ColorFade([TestEnum.Choice1,TestEnum.Choice2],10%)", true)] + public void OptionSetBackingColorTests(string expression, bool valid) + { + var enumStoreBuilder = new EnumStoreBuilder(); + enumStoreBuilder.TestOnly_WithCustomEnum(new EnumSymbol( + new DName("TestEnum"), + DType.Color, + new Dictionary() + { + { "Choice1", 0 }, + { "Choice2", 255 }, + })); + var config = PowerFxConfig.BuildWithEnumStore(enumStoreBuilder, features: Features.PowerFxV1); + var recalcEngine = new RecalcEngine(config); + + var checkResult = recalcEngine.Check(expression, RecordType.Empty()); + Assert.Equal(valid, checkResult.IsSuccess); + } + [Fact] public void TestWithTimeZoneInfo() { From df482e071e78caf0a29ff12cf5ec28ad7633b44b Mon Sep 17 00:00:00 2001 From: Anderson Silva Date: Wed, 28 Feb 2024 13:55:01 -0600 Subject: [PATCH 5/9] REPL fix to print blank records (#2236) Fix for a small issue I found while using REPL. `Table({Value:1}, Blank())` --- .../Services/StandardFormatter.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/libraries/Microsoft.PowerFx.Repl/Services/StandardFormatter.cs b/src/libraries/Microsoft.PowerFx.Repl/Services/StandardFormatter.cs index 24bccb9397..c5918e5d0f 100644 --- a/src/libraries/Microsoft.PowerFx.Repl/Services/StandardFormatter.cs +++ b/src/libraries/Microsoft.PowerFx.Repl/Services/StandardFormatter.cs @@ -118,16 +118,25 @@ private string FormatStandardTable(TableValue table, HashSet selectedFie } // special treatment for single column table named Value - else if (table.Rows.Count() > 0 && - table.Rows.First().Value?.Fields.Count() == 1 && - table.Rows.First().Value?.Fields.First().Name == "Value") + else if (table.Rows.Count() > 0 && + table.Type.FieldNames.Count() == 1 && + table.Type.FieldNames.First() == "Value") { var separator = string.Empty; resultString = new StringBuilder("["); foreach (var row in table.Rows) { resultString.Append(separator); - resultString.Append(FormatField(row.Value.Fields.First(), false)); + + if (row.IsValue) + { + resultString.Append(FormatField(row.Value.Fields.First(), false)); + } + else + { + resultString.Append(row.IsError ? row.Error?.Errors?[0].Message : "Blank()"); + } + separator = ", "; } From 213a272105dcf150ca6bd4e50a440169683eb67f Mon Sep 17 00:00:00 2001 From: Greg Lindhorst Date: Wed, 28 Feb 2024 18:26:31 -0800 Subject: [PATCH 6/9] Deprecate OptionSetInfo, prepare way for new ChoiceInfo function (#2235) OptionSetInfo only returns one value, the logical name of an option set choice. We'd like to redesign this function to accommodate: 1. The logical name is a text wrapped number for number and Boolean backed option sets coming from Dataverse. We recently added the ability to get at these values with the Value and Boolean functions which is a better way, strongly typed. https://github.com/microsoft/Power-Fx/pull/2230 1. There are other pieces of information that are worth knowing, for example the color of an option set choice, that can't be accommodated with this design. 1. Our preferred design is to return an extensible record of information. We could add an additional second argument with an enum to determine what information to return, with a default value of logical name, but this isn't our first choice. 1. We don't use the term OptionSet any longer in Dataverse, it has been replaced with Choice, which is more consistent with our existing Choices function. As some hosts may still be using this function, it will remain available as a function that can be enabled by calling config.EnableOptionSetInfo. Value/Boolean can be used immediately as a workaround, wrapped with Text if needed. We plan to add a new ChoiceInfo function with a separate PR. --- .../Texl/BuiltinFunctionsCore.cs | 1 - .../Texl/Builtins/OptionSetInfo.cs | 27 ---------- .../Environment/PowerFxConfigExtensions.cs | 7 +++ .../Functions/Library.cs | 11 ---- .../Functions/LibraryText.cs | 7 --- .../Functions/OptionSetInfo.cs | 50 +++++++++++++++++++ .../Docs/DocTests.cs | 1 + .../RecalcEngineTests.cs | 3 ++ src/tools/Repl/Program.cs | 3 ++ 9 files changed, 64 insertions(+), 46 deletions(-) delete mode 100644 src/libraries/Microsoft.PowerFx.Core/Texl/Builtins/OptionSetInfo.cs create mode 100644 src/libraries/Microsoft.PowerFx.Interpreter/Functions/OptionSetInfo.cs diff --git a/src/libraries/Microsoft.PowerFx.Core/Texl/BuiltinFunctionsCore.cs b/src/libraries/Microsoft.PowerFx.Core/Texl/BuiltinFunctionsCore.cs index 54198afa89..0090b26361 100644 --- a/src/libraries/Microsoft.PowerFx.Core/Texl/BuiltinFunctionsCore.cs +++ b/src/libraries/Microsoft.PowerFx.Core/Texl/BuiltinFunctionsCore.cs @@ -253,7 +253,6 @@ internal class BuiltinFunctionsCore public static readonly TexlFunction Float = _featureGateFunctions.Add(new FloatFunction()); public static readonly TexlFunction Float_UO = _featureGateFunctions.Add(new FloatFunction_UO()); public static readonly TexlFunction IsUTCToday = _featureGateFunctions.Add(new IsUTCTodayFunction()); - public static readonly TexlFunction OptionsSetInfo = _featureGateFunctions.Add(new OptionSetInfoFunction()); public static readonly TexlFunction UTCNow = _featureGateFunctions.Add(new UTCNowFunction()); public static readonly TexlFunction UTCToday = _featureGateFunctions.Add(new UTCTodayFunction()); public static readonly TexlFunction BooleanL = _featureGateFunctions.Add(new BooleanLFunction()); diff --git a/src/libraries/Microsoft.PowerFx.Core/Texl/Builtins/OptionSetInfo.cs b/src/libraries/Microsoft.PowerFx.Core/Texl/Builtins/OptionSetInfo.cs deleted file mode 100644 index 780bf69578..0000000000 --- a/src/libraries/Microsoft.PowerFx.Core/Texl/Builtins/OptionSetInfo.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -using System.Collections.Generic; -using Microsoft.PowerFx.Core.Functions; -using Microsoft.PowerFx.Core.Localization; -using Microsoft.PowerFx.Core.Types; - -namespace Microsoft.PowerFx.Core.Texl.Builtins -{ - internal sealed class OptionSetInfoFunction : BuiltinFunction - { - public override bool IsSelfContained => true; - - public override bool SupportsParamCoercion => false; - - public OptionSetInfoFunction() - : base("OptionSetInfo", TexlStrings.AboutOptionSetInfo, FunctionCategories.Text, DType.String, 0, 1, 1, DType.OptionSetValue) - { - } - - public override IEnumerable GetSignatures() - { - yield return new[] { TexlStrings.AboutOptionSetInfoArg1 }; - } - } -} diff --git a/src/libraries/Microsoft.PowerFx.Interpreter/Environment/PowerFxConfigExtensions.cs b/src/libraries/Microsoft.PowerFx.Interpreter/Environment/PowerFxConfigExtensions.cs index 8ea79c6a0d..5c5064f8d0 100644 --- a/src/libraries/Microsoft.PowerFx.Interpreter/Environment/PowerFxConfigExtensions.cs +++ b/src/libraries/Microsoft.PowerFx.Interpreter/Environment/PowerFxConfigExtensions.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using Microsoft.PowerFx.Core.Functions; +using Microsoft.PowerFx.Core.Texl.Builtins; using Microsoft.PowerFx.Functions; using Microsoft.PowerFx.Interpreter; @@ -60,5 +61,11 @@ public static void EnableRegExFunctions(this PowerFxConfig config, TimeSpan regE config.AdditionalFunctions.Add(func.Key, func.Value); } } + + [Obsolete("OptionSetInfo function is deprecated. Use the Value function on an option set backed by a number and the Boolean function on an option set backed by a Boolean instead. A new ChoiceInfo function is in the works for access to logical names.")] + public static void EnableOptionSetInfo(this PowerFxConfig powerFxConfig) + { + powerFxConfig.AddFunction(new OptionSetInfoFunction()); + } } } diff --git a/src/libraries/Microsoft.PowerFx.Interpreter/Functions/Library.cs b/src/libraries/Microsoft.PowerFx.Interpreter/Functions/Library.cs index d4c9364620..fb2353b06d 100644 --- a/src/libraries/Microsoft.PowerFx.Interpreter/Functions/Library.cs +++ b/src/libraries/Microsoft.PowerFx.Interpreter/Functions/Library.cs @@ -1235,17 +1235,6 @@ static Library() BuiltinFunctionsCore.Now, NoErrorHandling(Now) }, - { - BuiltinFunctionsCore.OptionsSetInfo, - StandardErrorHandling( - BuiltinFunctionsCore.OptionsSetInfo.Name, - expandArguments: NoArgExpansion, - replaceBlankValues: DoNotReplaceBlank, - checkRuntimeTypes: ExactValueTypeOrBlank, - checkRuntimeValues: DeferRuntimeValueChecking, - returnBehavior: ReturnBehavior.ReturnEmptyStringIfAnyArgIsBlank, - targetFunction: OptionSetValueToLogicalName) - }, { BuiltinFunctionsCore.Or, Or diff --git a/src/libraries/Microsoft.PowerFx.Interpreter/Functions/LibraryText.cs b/src/libraries/Microsoft.PowerFx.Interpreter/Functions/LibraryText.cs index 441853da85..7171521887 100644 --- a/src/libraries/Microsoft.PowerFx.Interpreter/Functions/LibraryText.cs +++ b/src/libraries/Microsoft.PowerFx.Interpreter/Functions/LibraryText.cs @@ -1169,13 +1169,6 @@ public static FormulaValue GuidPure(IRContext irContext, StringValue[] args) } } - public static FormulaValue OptionSetValueToLogicalName(IRContext irContext, OptionSetValue[] args) - { - var optionSet = args[0]; - var logicalName = optionSet.Option; - return new StringValue(irContext, logicalName); - } - public static FormulaValue PlainText(IRContext irContext, StringValue[] args) { string text = args[0].Value.Trim(); diff --git a/src/libraries/Microsoft.PowerFx.Interpreter/Functions/OptionSetInfo.cs b/src/libraries/Microsoft.PowerFx.Interpreter/Functions/OptionSetInfo.cs new file mode 100644 index 0000000000..07fa066f56 --- /dev/null +++ b/src/libraries/Microsoft.PowerFx.Interpreter/Functions/OptionSetInfo.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.PowerFx.Core.Functions; +using Microsoft.PowerFx.Core.IR; +using Microsoft.PowerFx.Core.Localization; +using Microsoft.PowerFx.Core.Types; +using Microsoft.PowerFx.Core.Utils; +using Microsoft.PowerFx.Functions; +using Microsoft.PowerFx.Types; + +namespace Microsoft.PowerFx.Interpreter +{ + internal sealed class OptionSetInfoFunction : TexlFunction, IAsyncTexlFunction + { + public override bool IsSelfContained => true; + + public override bool SupportsParamCoercion => false; + + public OptionSetInfoFunction() + : base(DPath.Root, "OptionSetInfo", "OptionSetInfo", TexlStrings.AboutOptionSetInfo, FunctionCategories.Text, DType.String, 0, 1, 1, DType.OptionSetValue) + { + } + + public override IEnumerable GetSignatures() + { + yield return new[] { TexlStrings.AboutOptionSetInfoArg1 }; + } + + public async Task InvokeAsync(FormulaValue[] args, CancellationToken cancellationToken) + { + cancellationToken.ThrowIfCancellationRequested(); + + switch (args[0]) + { + case ErrorValue errorValue: + return errorValue; + case BlankValue: + return new StringValue(IRContext.NotInSource(FormulaType.String), string.Empty); + case OptionSetValue osv: + return new StringValue(IRContext.NotInSource(FormulaType.String), osv.Option); + } + + return CommonErrors.GenericInvalidArgument(args[0].IRContext); + } + } +} diff --git a/src/tests/Microsoft.PowerFx.Interpreter.Tests/Docs/DocTests.cs b/src/tests/Microsoft.PowerFx.Interpreter.Tests/Docs/DocTests.cs index e763242faa..d65e64ae86 100644 --- a/src/tests/Microsoft.PowerFx.Interpreter.Tests/Docs/DocTests.cs +++ b/src/tests/Microsoft.PowerFx.Interpreter.Tests/Docs/DocTests.cs @@ -16,6 +16,7 @@ public void Test() config.EnableJsonFunctions(); #pragma warning disable CS0618 // Type or member is obsolete config.EnableRegExFunctions(); + config.EnableOptionSetInfo(); #pragma warning restore CS0618 // Type or member is obsolete config.SymbolTable.EnableMutationFunctions(); diff --git a/src/tests/Microsoft.PowerFx.Interpreter.Tests/RecalcEngineTests.cs b/src/tests/Microsoft.PowerFx.Interpreter.Tests/RecalcEngineTests.cs index 4502e0e8eb..f4a5283762 100644 --- a/src/tests/Microsoft.PowerFx.Interpreter.Tests/RecalcEngineTests.cs +++ b/src/tests/Microsoft.PowerFx.Interpreter.Tests/RecalcEngineTests.cs @@ -1032,6 +1032,9 @@ public async void OptionSetInfoTests(string expression, string expected) symValues.Set(option1Solt, option1); var config = new PowerFxConfig() { SymbolTable = symbol }; +#pragma warning disable CS0618 // Type or member is obsolete + config.EnableOptionSetInfo(); +#pragma warning restore CS0618 // Type or member is obsolete config.AddOptionSet(optionSet); var recalcEngine = new RecalcEngine(config); diff --git a/src/tools/Repl/Program.cs b/src/tools/Repl/Program.cs index 28c769d85a..e5afa6f52b 100644 --- a/src/tools/Repl/Program.cs +++ b/src/tools/Repl/Program.cs @@ -79,6 +79,9 @@ private static RecalcEngine ReplRecalcEngine() config.EnableSetFunction(); config.EnableJsonFunctions(); +#pragma warning disable CS0618 // Type or member is obsolete + config.EnableOptionSetInfo(); +#pragma warning restore CS0618 // Type or member is obsolete config.AddFunction(new ResetFunction()); config.AddFunction(new Option0Function()); From 2c5e63657f24d1941b30e3667bfcd5ea9fbfd75c Mon Sep 17 00:00:00 2001 From: toshio-msft <93787062+toshio-msft@users.noreply.github.com> Date: Tue, 5 Mar 2024 04:44:41 -0800 Subject: [PATCH 7/9] [[Power-Fx]] Localization hand-back [CTAS - RunID=20240229-192041-d0y9s1p5d1] (#2238) Translation handback check-in (PR Created by automation). --- src/strings/PowerFxResources.bg-BG.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.ca-ES.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.cs-CZ.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.da-DK.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.de-DE.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.el-GR.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.es-ES.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.et-EE.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.eu-ES.resx | 46 +++++++++++++++++- src/strings/PowerFxResources.fi-FI.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.fr-FR.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.gl-ES.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.hi-IN.resx | 50 ++++++++++++++++++-- src/strings/PowerFxResources.hr-HR.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.hu-HU.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.id-ID.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.it-IT.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.ja-JP.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.kk-KZ.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.ko-KR.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.lt-LT.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.lv-LV.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.ms-MY.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.nb-NO.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.nl-NL.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.pl-PL.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.pt-BR.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.pt-PT.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.ro-RO.resx | 46 +++++++++++++++++- src/strings/PowerFxResources.ru-RU.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.sk-SK.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.sl-SI.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.sr-Cyrl-RS.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.sr-Latn-RS.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.sv-SE.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.th-TH.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.tr-TR.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.uk-UA.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.vi-VN.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.zh-CN.resx | 44 +++++++++++++++++ src/strings/PowerFxResources.zh-TW.resx | 44 +++++++++++++++++ 41 files changed, 1809 insertions(+), 5 deletions(-) diff --git a/src/strings/PowerFxResources.bg-BG.resx b/src/strings/PowerFxResources.bg-BG.resx index 6f8404a581..52b78518fc 100644 --- a/src/strings/PowerFxResources.bg-BG.resx +++ b/src/strings/PowerFxResources.bg-BG.resx @@ -581,6 +581,50 @@ Колона с булеви стойности за обработване. + + Преобразува десетично число в булева стойност. + + + + число + + + + Десетичната числова стойност, която да бъде преобразувана в булева стойност. + + + Преобразува колона с десетични числови стойности в колона с булеви стойности. + + + + входни данни + + + + Колона с числови стойности, която да бъде обработена. + + + Преобразува стойност за избор, функционираща на основата на булева стойност, в булева стойност. + + + + възможност за избор + + + + Стойността за избор, която да бъде преобразувана в булева стойност. + + + Преобразува колона със стойности за избор, функциониращи на основата на булеви стойности, в колона с булеви стойности. + + + + входни данни + + + + Колона със стойности за избор, която да бъде обработена. + Връща първия непразен аргумент diff --git a/src/strings/PowerFxResources.ca-ES.resx b/src/strings/PowerFxResources.ca-ES.resx index 45e83f1dde..8a563cea6d 100644 --- a/src/strings/PowerFxResources.ca-ES.resx +++ b/src/strings/PowerFxResources.ca-ES.resx @@ -581,6 +581,50 @@ Columna de valors booleans que es processaran. + + Converteix un nombre decimal en un valor booleà. + + + + nombre + + + + Valor numèric decimal que es convertirà en un valor booleà. + + + Converteix una columna de valors numèrics decimals en una columna de valors booleans. + + + + entrada + + + + Columna de valors numèrics que es processarà. + + + Converteix un valor d'opció amb el suport d'un booleà en un valor booleà. + + + + opció + + + + L'opció que es convertirà en un valor booleà. + + + Converteix una columna de valors d'opció amb el suport de booleans en una columna de valors booleans. + + + + entrada + + + + Columna de valors d'opció que es processarà. + Retorna el primer argument que no està en blanc diff --git a/src/strings/PowerFxResources.cs-CZ.resx b/src/strings/PowerFxResources.cs-CZ.resx index 695231d22e..8b36dea8b6 100644 --- a/src/strings/PowerFxResources.cs-CZ.resx +++ b/src/strings/PowerFxResources.cs-CZ.resx @@ -581,6 +581,50 @@ Sloupec logických hodnot ke zpracování. + + Převede desetinné číslo na logickou hodnotu. + + + + číslo + + + + Desetinná číselná hodnota, kterou chcete převést na logickou hodnotu. + + + Převede sloupec desetinných číselných hodnot na sloupec logických hodnot. + + + + vstup + + + + Sloupec číselných hodnot, které se mají zpracovat. + + + Převede hodnotu volby podpořenou logickou hodnotou na logickou hodnotu. + + + + volba + + + + Volba, kterou chcete převést na logickou hodnotu. + + + Převede sloupec hodnot výběru podpořený logickými hodnotami na sloupec logických hodnot. + + + + vstup + + + + Sloupec hodnot výběru, které se mají zpracovat. + Vrátí první neprázdný argument diff --git a/src/strings/PowerFxResources.da-DK.resx b/src/strings/PowerFxResources.da-DK.resx index 786ee62149..813530647a 100644 --- a/src/strings/PowerFxResources.da-DK.resx +++ b/src/strings/PowerFxResources.da-DK.resx @@ -581,6 +581,50 @@ En kolonne med booleske værdier, der skal behandles. + + Konverterer et decimaltal til en boolesk værdi. + + + + tal + + + + Den decimaltalværdi, der skal konverteres til en boolesk værdi. + + + Konverterer en kolonne med numeriske decimalværdier til en kolonne med booleske værdier. + + + + input + + + + En kolonne af numeriske værdier, der skal behandles. + + + Konverterer en valgværdi, som understøttes af en boolesk værdi, til en boolesk værdi. + + + + valg + + + + Det valg, der skal konverteres til en boolesk værdi. + + + Konverterer en kolonne med valgværdier, som understøttes af booleske værdier, til en kolonne med booleske værdier. + + + + input + + + + En kolonne af valgværdier, der skal behandles. + Returnerer det første ikke-tomme argument diff --git a/src/strings/PowerFxResources.de-DE.resx b/src/strings/PowerFxResources.de-DE.resx index f4ad5b5767..c59b9e8bf3 100644 --- a/src/strings/PowerFxResources.de-DE.resx +++ b/src/strings/PowerFxResources.de-DE.resx @@ -581,6 +581,50 @@ Eine Spalte mit booleschen Werten für die Verarbeitung. + + Konvertiert eine Dezimalzahl in einen booleschen Wert. + + + + Zahl + + + + Der Dezimalwert, der in einen booleschen Wert konvertiert werden soll. + + + Konvertiert eine Spalte mit Dezimalwerten in eine Spalte mit booleschen Werten. + + + + Eingabe + + + + Eine Spalte mit zu verarbeitenden Nummernwerten. + + + Konvertiert einen auf einen booleschen Wert gestützten Auswahlwert zu einem booleschen Wert. + + + + Auswahl + + + + Der Auswahlwert, der in einen booleschen Wert konvertiert werden soll. + + + Konvertiert eine Spalte mit auf booleschen Werten gestützten Auswahlwerten in eine Spalte mit booleschen Werten. + + + + Eingabe + + + + Eine Spalte mit zu verarbeitenden Auswahlwerten + Hiermit wird das erste nicht leere Argument zurückgegeben. diff --git a/src/strings/PowerFxResources.el-GR.resx b/src/strings/PowerFxResources.el-GR.resx index a8494fed3a..98c58ecc26 100644 --- a/src/strings/PowerFxResources.el-GR.resx +++ b/src/strings/PowerFxResources.el-GR.resx @@ -581,6 +581,50 @@ Μια στήλη δυαδικών τιμών για επεξεργασία. + + Μετατρέπει έναν δεκαδικό αριθμό σε δυαδική τιμή. + + + + αριθμός + + + + Η τιμή δεκαδικού αριθμού για μετατροπή σε δυαδική τιμή. + + + Μετατρέπει μια στήλη δεκαδικών αριθμητικών τιμών σε στήλη δυαδικών τιμών. + + + + δεδομένα_εισόδου + + + + Στήλη αριθμητικών τιμών για επεξεργασία. + + + Μετατρέπει μια τιμή επιλογής, η οποία υποστηρίζεται από δυαδική τιμή σε δυαδική τιμή. + + + + επιλογή + + + + Η επιλογή για μετατροπή σε δυαδική τιμή. + + + Μετατρέπει μια στήλη τιμών επιλογής που υποστηρίζονται από δυαδικές τιμές σε στήλη δυαδικών τιμών. + + + + δεδομένα_εισόδου + + + + Στήλη τιμών επιλογής για επεξεργασία. + Επιστρέφει το πρώτο μη κενό όρισμα diff --git a/src/strings/PowerFxResources.es-ES.resx b/src/strings/PowerFxResources.es-ES.resx index 6502e190e0..cd8932fa8b 100644 --- a/src/strings/PowerFxResources.es-ES.resx +++ b/src/strings/PowerFxResources.es-ES.resx @@ -581,6 +581,50 @@ Columna de valores booleanos para procesar. + + Convierte un número decimal en un valor booleano. + + + + número + + + + Valor numérico decimal que se convertirá en un valor booleano. + + + Convierte una columna de valores numéricos decimales en una columna de valores booleanos. + + + + entrada + + + + Una columna de valores numéricos que se procesarán. + + + Convierte un valor de opción respaldado por un valor booleano en un valor booleano. + + + + opción + + + + La opción que se convertirá en un valor booleano. + + + Convierte una columna de valores de opción respaldada por booleanos en una columna de valores booleanos. + + + + entrada + + + + Columna de valores de opción que se procesarán. + Devuelve el primer argumento que no está en blanco. diff --git a/src/strings/PowerFxResources.et-EE.resx b/src/strings/PowerFxResources.et-EE.resx index f9712a56c9..f5658597be 100644 --- a/src/strings/PowerFxResources.et-EE.resx +++ b/src/strings/PowerFxResources.et-EE.resx @@ -581,6 +581,50 @@ Töödeldav loogiliste väärtuste veerg. + + Teisendab kümnendarvu loogikaväärtuseks. + + + + arv + + + + Arvväärtus loogikaväärtuseks teisendamise jaoks. + + + Teisendab arvväärtuste veeru loogikaväärtuste veeruks. + + + + sisend + + + + Töödeldav arvväärtuste veerg. + + + Teisendab valikuväärtuse loogilise väärtuse alusel loogiliseks väärtuseks. + + + + valik + + + + Valik loogiliseks väärtuseks teisendamise jaoks. + + + Teisendab loogikaväärtuste alusel valikuväärtused veeru loogikaväärtuste veeruks. + + + + sisend + + + + Töödeldav valikuväärtuste veerg. + Tagastab esimese mittetühja argumendi diff --git a/src/strings/PowerFxResources.eu-ES.resx b/src/strings/PowerFxResources.eu-ES.resx index 746b94e9f8..72fca11d74 100644 --- a/src/strings/PowerFxResources.eu-ES.resx +++ b/src/strings/PowerFxResources.eu-ES.resx @@ -581,6 +581,50 @@ Prozesatuko diren balio boolearren zutabea. + + Zenbaki hamartar bat bihurtzen du balio boolear. + + + + zenbakia + + + + Balio hamartarra balio boolear bihurtzeko aukera. + + + Zenbakizko balioak dituen zutabe bat bihurtzen du balio boolearrak dituen zutabe. + + + + sarrera + + + + Prozesatuko den zenbakizko balioen zutabea. + + + Balio boolear batek babestutako aukerako balio bat bihurtzen du balio boolear. + + + + aukera + + + + Balio boolear bihurtzeko aukera. + + + Balio boolearrak dituen zutabe bat bihurtzen du balio boolearrak babestutako aukerako balioak dituen zutabe. + + + + sarrera + + + + Prozesatuko den aukerako balioen zutabea. + Hutsa ez den lehen argumentua itzultzen du @@ -4235,7 +4279,7 @@ - Unicode karaktere bihurtuko den zenbakizko balioa + Unicode karaktere bihurtuko den zenbakizko balioa. zenbakia diff --git a/src/strings/PowerFxResources.fi-FI.resx b/src/strings/PowerFxResources.fi-FI.resx index 83f40884c6..a6ace7f7cc 100644 --- a/src/strings/PowerFxResources.fi-FI.resx +++ b/src/strings/PowerFxResources.fi-FI.resx @@ -581,6 +581,50 @@ Käsiteltävä totuusarvosarake. + + Muuntaa desimaaliluvun totuusarvoksi. + + + + numero + + + + Desimaalilukuarvo, joka muunnetaan totuusarvoksi. + + + Muuntaa desimaalilukuarvojen sarakkeen totuusarvosarakkeeksi. + + + + syöte + + + + Käsiteltävien numeroarvojen sarake. + + + Muuntaa valinta-arvon, jonka taustalla on totuusarvo, totuusarvoksi. + + + + valinta + + + + Valinta, joka muunnetaan totuusarvoksi. + + + Muutaa valinta-arvojen sarakkeen, jonka taustalla on totuusarvoja, totuusarvosarakkeeksi. + + + + syöte + + + + Käsiteltävien valinta-arvojen sarake. + Palauttaa ensimmäisen muun kuin tyhjän argumentin diff --git a/src/strings/PowerFxResources.fr-FR.resx b/src/strings/PowerFxResources.fr-FR.resx index b11c0b65b4..7042a5052c 100644 --- a/src/strings/PowerFxResources.fr-FR.resx +++ b/src/strings/PowerFxResources.fr-FR.resx @@ -581,6 +581,50 @@ Colonne de valeurs booléennes à traiter. + + Convertit un nombre décimal en une valeur booléenne. + + + + nombre + + + + Valeur numérique décimale à convertir en valeur booléenne. + + + Convertit une colonne de valeurs numériques décimales en une colonne de valeurs booléennes. + + + + entrée + + + + Colonne de valeurs numériques à traiter. + + + Convertit une valeur de choix soutenue par un booléen en une valeur booléenne. + + + + choix + + + + Choix à convertir en valeur booléenne. + + + Convertit une colonne de valeurs de choix soutenues par des booléens en valeurs booléennes. + + + + entrée + + + + Colonne de valeurs de choix à traiter. + Retourne le premier argument non vide diff --git a/src/strings/PowerFxResources.gl-ES.resx b/src/strings/PowerFxResources.gl-ES.resx index 1bb6e43e5b..4e1428e8c3 100644 --- a/src/strings/PowerFxResources.gl-ES.resx +++ b/src/strings/PowerFxResources.gl-ES.resx @@ -581,6 +581,50 @@ Columna de valores booleanos que se van procesar. + + Converte un número decimal nun valor booleano. + + + + número + + + + Valor de número decimal que se vai converter nun valor booleano. + + + Converte unha columna de valores de números decimais nunha columna de valores booleanos. + + + + entrada + + + + Columna de valores numéricos que se van procesar. + + + Converte un valor de elección respaldado por un booleano nun valor booleano. + + + + elección + + + + Elección que se vai converter nun valor booleano. + + + Converte unha columna de valores de elección respaldados por booleanos nunha columna de valores booleanos. + + + + entrada + + + + Columna de valores de elección que se van procesar. + Devolve o primeiro argumento que non está en branco diff --git a/src/strings/PowerFxResources.hi-IN.resx b/src/strings/PowerFxResources.hi-IN.resx index f0a61c5c57..bf444f9db3 100644 --- a/src/strings/PowerFxResources.hi-IN.resx +++ b/src/strings/PowerFxResources.hi-IN.resx @@ -581,6 +581,50 @@ प्रक्रिया के लिए बूलियन मानों का एक कॉलम. + + दशमलव संख्या को बूलियन मान में रूपांतरित करें. + + + + संख्या + + + + बूलियन मान में रूपांतरित करने के लिए दशमलव संख्या वाला मान. + + + दशमलव संख्या वाले मानों के एक कॉलम को बूलियन मानों के कॉलम में रूपांतरित करें. + + + + इनपुट + + + + संसाधित किए जाने वाले संख्या मानों का कॉलम. + + + बूलियन द्वारा समर्थित विकल्प मान को बूलियन मान में रूपांतरित करें. + + + + विकल्प + + + + बूलियन मान में रूपांतरित का विकल्प. + + + बूलियन द्वारा समर्थित विकल्प मानों के एक कॉलम को बूलियन मानों के कॉलम में रूपांतरित करें. + + + + इनपुट + + + + संसाधित करने के लिए विकल्प मानों का एक कॉलम. + पहला गैर रिक्त तर्क वापस करता है @@ -4235,14 +4279,14 @@ - संख्यात्मक मान को यूनिकोड वर्ण में परिवर्तित किया जाएगा. + संख्यात्मक मान को यूनिकोड वर्ण में रूपांतरित किया जाएगा. संख्या - संख्यात्मक मानों की तालिका को यूनिकोड वर्णों की तालिका में परिवर्तित करता है. + संख्यात्मक मानों की तालिका को यूनिकोड वर्णों की तालिका में रूपांतरित करता है. @@ -4250,7 +4294,7 @@ - संख्यात्मक मानों का एक तालिका कॉलम यूनिकोड वर्णों में परिवर्तित किया जाना है. + संख्यात्मक मानों का एक तालिका कॉलम यूनिकोड वर्णों में रूपांतरित किया जाना है. असमर्थित विशेषता प्रकार diff --git a/src/strings/PowerFxResources.hr-HR.resx b/src/strings/PowerFxResources.hr-HR.resx index b8665b6210..5c539f6a95 100644 --- a/src/strings/PowerFxResources.hr-HR.resx +++ b/src/strings/PowerFxResources.hr-HR.resx @@ -581,6 +581,50 @@ Stupac Booleovih vrijednosti za obradu. + + Pretvara decimalni broj u booleovu vrijednost. + + + + broj + + + + Vrijednost decimalnog broja koju treba pretvoriti u booleovu vrijednost. + + + Pretvara stupac decimalnih brojčanih vrijednosti u stupac booleovih vrijednosti. + + + + unos + + + + Stupac brojčanih vrijednosti koji treba obraditi. + + + Pretvara vrijednost odabira koju podržava booleova vrijednost u booleovu vrijednost. + + + + odabir + + + + Odabir koji treba pretvoriti u booleovu vrijednost. + + + Pretvara stupac vrijednosti odabira koje podržavaju booleove vrijednosti u stupac booleovih vrijednosti. + + + + unos + + + + Stupac vrijednosti odabira koji treba obraditi. + Vraća prvi argument koji nije prazan diff --git a/src/strings/PowerFxResources.hu-HU.resx b/src/strings/PowerFxResources.hu-HU.resx index 4754238bbb..5e431423c8 100644 --- a/src/strings/PowerFxResources.hu-HU.resx +++ b/src/strings/PowerFxResources.hu-HU.resx @@ -581,6 +581,50 @@ A feldolgozandó logikai értékeket tartalmazó oszlop. + + Átalakít egy tizedest logikai értékké. + + + + szám + + + + A logikai értékké alakítandó tizedes érték. + + + Tizedesjeggyel rendelkező numerikus értékekből álló oszlopot logikai értékek oszlopává alakít át. + + + + bevitel + + + + A feldolgozandó számértékeket tartalmazó oszlop. + + + Egy logikai értékkel támogatott választási értéket logikai értékké alakít. + + + + választási lehetőség + + + + A logikai értékké alakítandó választás. + + + Logikai értékekkel támogatott választási értékekből álló oszlopot logikai értékek oszlopává alakít át. + + + + bevitel + + + + A feldolgozandó választható értékeket tartalmazó oszlop. + Az első nem üres argumentumot adja vissza diff --git a/src/strings/PowerFxResources.id-ID.resx b/src/strings/PowerFxResources.id-ID.resx index e6f439c100..ceb62b9c10 100644 --- a/src/strings/PowerFxResources.id-ID.resx +++ b/src/strings/PowerFxResources.id-ID.resx @@ -581,6 +581,50 @@ Kolom nilai boolean untuk diproses. + + Mengonversi angka desimal ke nilai boolean. + + + + angka + + + + Nilai angka desimal yang akan dikonversi ke nilai boolean. + + + Mengonversi kolom nilai numerik desimal ke kolom nilai boolean. + + + + masukan + + + + Kolom nilai angka untuk diproses. + + + Mengonversi nilai pilihan yang didukung oleh boolean ke nilai boolean. + + + + pilihan + + + + Nilai pilihan yang akan dikonversi ke nilai boolean. + + + Mengonversi kolom nilai pilihan yang didukung oleh boolean ke kolom nilai boolean. + + + + masukan + + + + Kolom nilai pilihan yang akan diproses. + Menampilkan argumen tidak kosong pertama diff --git a/src/strings/PowerFxResources.it-IT.resx b/src/strings/PowerFxResources.it-IT.resx index 642cc14739..6462e0be04 100644 --- a/src/strings/PowerFxResources.it-IT.resx +++ b/src/strings/PowerFxResources.it-IT.resx @@ -581,6 +581,50 @@ Colonna di valori boolean da elaborare. + + Converte un valore decimale in un valore booleano. + + + + numero + + + + Valore numerico decimale da convertire in un valore booleano. + + + Converte una colonna di valori numerici decimali in una colonna di valori booleani. + + + + input + + + + Colonna di valori numerici da elaborare. + + + Converte un valore di scelta supportato da un valore booleano in un valore booleano. + + + + scelta + + + + Scelta per convertire in un valore booleano. + + + Converte una colonna di valori i scelta supportati dai valori booleani in una colonna di valori booleani. + + + + input + + + + Colonna di valori di scelta da elaborare. + Restituisce il primo argomento non vuoto diff --git a/src/strings/PowerFxResources.ja-JP.resx b/src/strings/PowerFxResources.ja-JP.resx index 272741ac3e..f2c11f52ab 100644 --- a/src/strings/PowerFxResources.ja-JP.resx +++ b/src/strings/PowerFxResources.ja-JP.resx @@ -581,6 +581,50 @@ 処理するブール値の列です。 + + 10 進数をブール値に変換します。 + + + + 数値 + + + + ブール値に変換する 10 進数の値です。 + + + 10 進数の値の列をブール値の列に変換します。 + + + + 入力 + + + + 処理する数値の列。 + + + ブール値から変換された選択肢の値をブール値に戻します。 + + + + 選択肢 + + + + ブール値に変換する選択肢です。 + + + ブール値から変換された選択肢の値の列をブール値の列に戻します。 + + + + 入力 + + + + 処理する選択肢の値の列です。 + 空でない最初の引数を返します diff --git a/src/strings/PowerFxResources.kk-KZ.resx b/src/strings/PowerFxResources.kk-KZ.resx index 047de1b6e9..b0537d3d83 100644 --- a/src/strings/PowerFxResources.kk-KZ.resx +++ b/src/strings/PowerFxResources.kk-KZ.resx @@ -581,6 +581,50 @@ Өңделетін логикалық мәндер бағаны. + + Ондық бөлшек санын логикалық мәнге түрлендіреді. + + + + сан + + + + Логикалық мәнге түрлендірілетін ондық бөлшек мәні. + + + Ондық бөлшек мәндері бағанын логикалық мәндер бағанына түрлендіреді. + + + + кіріс + + + + Өңделетін сандық мәндер бағаны. + + + Логикалық мәнмен сақталған таңдаулы мәнді логикалық мәнге түрлендіреді. + + + + таңдау + + + + Логикалық мәнге түрлендірілетін таңдау. + + + Логикалық мәндермен сақталған таңдаулы мәндер бағанын логикалық мәндер бағанына түрлендіреді. + + + + кіріс + + + + Өңделетін таңдаулы мәндер бағаны. + Бірінші бос емес аргументті қайтарады diff --git a/src/strings/PowerFxResources.ko-KR.resx b/src/strings/PowerFxResources.ko-KR.resx index 96565778ea..0521a58909 100644 --- a/src/strings/PowerFxResources.ko-KR.resx +++ b/src/strings/PowerFxResources.ko-KR.resx @@ -581,6 +581,50 @@ 처리할 부울 값의 열입니다. + + 10진수를 부울 값으로 변환합니다. + + + + 숫자 + + + + 부울 값으로 변환할 10진수 값입니다. + + + 10진수 값 열을 부울 값 열로 변환합니다. + + + + 입력 + + + + 처리할 숫자 값 열입니다. + + + 부울로 백업되는 선택 값을 부울 값으로 변환합니다. + + + + 선택 항목 + + + + 부울 값으로 변환하는 선택 사항입니다. + + + 부울로 백업되는 선택 값 열을 부울 값 열로 변환합니다. + + + + 입력 + + + + 처리할 선택 값의 열입니다. + 공백이 아닌 첫 번째 인수를 반환함 diff --git a/src/strings/PowerFxResources.lt-LT.resx b/src/strings/PowerFxResources.lt-LT.resx index f3218bc741..b213695322 100644 --- a/src/strings/PowerFxResources.lt-LT.resx +++ b/src/strings/PowerFxResources.lt-LT.resx @@ -581,6 +581,50 @@ Bulio logikos reikšmių stulpelis, skirtas apdoroti. + + Konvertuoja dešimtainį skaičių į Bulio logikos reikšmę. + + + + skaičius + + + + Dešimtainė skaitinė reikšmė, kurią reikia konvertuoti į Bulio logikos reikšmę. + + + Konvertuoja dešimtainių skaitinių reikšmių stulpelį į Bulio logikos reikšmių stulpelį. + + + + įvestis + + + + Apdorotinų skaitinių reikšmių stulpelis. + + + Konvertuoja Bulio logikos reikšme pagrįstą pasirinkimo reikšmę į Bulio logikos reikšmę. + + + + pasirinkimas + + + + Pasirinkimas, kurį reikia konvertuoti į Bulio logikos reikšmę. + + + Konvertuoja Bulio logikos reikšmėmis pagrįstų pasirinkimo reikšmių stulpelį į Bulio logikos reikšmių stulpelį. + + + + įvestis + + + + Apdorotinų pasirinkimų reikšmių stulpelis. + Pateikiamas pirmasis netuščias argumentas diff --git a/src/strings/PowerFxResources.lv-LV.resx b/src/strings/PowerFxResources.lv-LV.resx index edd8ea98f4..f5f0226ff2 100644 --- a/src/strings/PowerFxResources.lv-LV.resx +++ b/src/strings/PowerFxResources.lv-LV.resx @@ -581,6 +581,50 @@ Apstrādājamā Būla vērtību kolonna. + + Pārvērš decimāldaļskaitli par Būla vērtību. + + + + skaitlis + + + + Decimāldaļskaitļa vērtība, kas jāpārvērš par Būla vērtību. + + + Pārvērš decimāldaļu skaitlisko vērtību kolonnu par Būla vērtību kolonnu. + + + + ievade + + + + Apstrādājamā skaitlisko vērtību kolonna. + + + Pārvērš izvēles vērtību, ko atbalsta Būla vērtība, par Būla vērtību. + + + + izvēle + + + + Izvēle, ko pārvērst par Būla vērtību. + + + Pārvērš izvēles vērtību kolonnu, ko atbalsta Būla vērtības, par Būla vērtību kolonnu. + + + + ievade + + + + Apstrādājamā izvēles vērtību kolonna. + Atgriež pirmo argumentu, kurš nav tukšs diff --git a/src/strings/PowerFxResources.ms-MY.resx b/src/strings/PowerFxResources.ms-MY.resx index b9384a482c..9d1802b329 100644 --- a/src/strings/PowerFxResources.ms-MY.resx +++ b/src/strings/PowerFxResources.ms-MY.resx @@ -581,6 +581,50 @@ Lajur nilai Boolean untuk diproses. + + Menukar nilai perpuluhan kepada nilai Boolean. + + + + nombor + + + + Nilai nombor perpuluhan untuk ditukar kepada nilai Boolean. + + + Menukar lajur nilai angka perpuluhan kepada lajur nilai Boolean. + + + + input + + + + Lajur nilai nombor untuk diproses. + + + Menukar nilai pilihan yang disokong oleh Boolean kepada nilai Boolean. + + + + pilihan + + + + Pilihan untuk ditukar kepada nilai Boolean. + + + Menukar lajur nilai pilihan yang disokong oleh Boolean kepada lajur nilai Boolean. + + + + input + + + + Lajur nilai pilihan untuk diproses. + Mengembalikan argumen bukan kosong pertama diff --git a/src/strings/PowerFxResources.nb-NO.resx b/src/strings/PowerFxResources.nb-NO.resx index 5ecde752a0..ccadc05ba2 100644 --- a/src/strings/PowerFxResources.nb-NO.resx +++ b/src/strings/PowerFxResources.nb-NO.resx @@ -581,6 +581,50 @@ En kolonne med boolske verdier som skal behandles. + + Konverterer et desimaltall til en boolsk verdi. + + + + tall + + + + De numeriske desimalverdiene som skal konverteres til en boolsk verdi. + + + Konverterer en kolonne med numeriske desimalverdier til en kolonne med boolske verdier. + + + + inndata + + + + En kolonne med tallverdier som skal behandles. + + + Konverterer en valgverdi støttet av en boolsk verdi til en boolsk verdi. + + + + valg + + + + Valget som skal konverteres til en boolsk verdi. + + + Konverterer en kolonne med valgverdier støttet av boolske verdier, til en kolonne med boolske verdier. + + + + inndata + + + + En kolonne med valgverdier som skal behandles. + Returnerer det første argumentet som ikke er tomt diff --git a/src/strings/PowerFxResources.nl-NL.resx b/src/strings/PowerFxResources.nl-NL.resx index 70f415bb6b..750b98adee 100644 --- a/src/strings/PowerFxResources.nl-NL.resx +++ b/src/strings/PowerFxResources.nl-NL.resx @@ -581,6 +581,50 @@ Een kolom met booleaanse waarden die moet worden verwerkt. + + Hiermee wordt een decimaal getal naar een booleaanse waarde geconverteerd. + + + + getal + + + + De decimale getalwaarde die moet worden geconverteerd naar een booleaanse waarde. + + + Hiermee wordt een kolom met decimale numerieke waarden naar een kolom met booleaanse waarden geconverteerd. + + + + invoer + + + + Een kolom met getalwaarden die moeten worden verwerkt. + + + Hiermee wordt een keuzewaarde op basis van een booleaanse waarde geconverteerd naar een booleaanse waarde. + + + + keuze + + + + De keuze die moet worden geconverteerd naar een booleaanse waarde. + + + Hiermee wordt een kolom met keuzewaarden op basis van booleaanse waarden naar een kolom met booleaanse waarden geconverteerd. + + + + invoer + + + + Een kolom met keuzewaarden die moeten worden verwerkt. + Hiermee wordt het eerste niet-lege argument geretourneerd diff --git a/src/strings/PowerFxResources.pl-PL.resx b/src/strings/PowerFxResources.pl-PL.resx index d4d11b5f21..e2a4b9758e 100644 --- a/src/strings/PowerFxResources.pl-PL.resx +++ b/src/strings/PowerFxResources.pl-PL.resx @@ -581,6 +581,50 @@ Kolumna wartości logicznych do przetworzenia. + + Konwertuje liczbę dziesiętną na wartość logiczną. + + + + liczba + + + + Wartość typu liczba dziesiętna do przekonwertowania na wartość logiczną. + + + Konwertuje kolumnę wartości typu liczba dziesiętna na kolumnę wartości logicznych. + + + + dane wejściowe + + + + Kolumna wartości liczbowych do przetworzenia. + + + Konwertuje wartość opcji wyboru opartą na wartości logicznej na wartość logiczną. + + + + opcja wyboru + + + + Opcja wyboru do przekonwertowania na wartość logiczną. + + + Konwertuje kolumnę wartości opcji wyboru opartych na wartościach logicznych na kolumnę wartości logicznych. + + + + dane wejściowe + + + + Kolumna wartości opcji wyboru do przetworzenia. + Zwraca pierwszy niepusty argument diff --git a/src/strings/PowerFxResources.pt-BR.resx b/src/strings/PowerFxResources.pt-BR.resx index 4991deeb32..6d7e90201a 100644 --- a/src/strings/PowerFxResources.pt-BR.resx +++ b/src/strings/PowerFxResources.pt-BR.resx @@ -581,6 +581,50 @@ Uma coluna de valores boolianos a ser processada. + + Converte um número decimal em um valor booliano. + + + + número + + + + O valor numérico decimal a ser convertido em um valor booliano. + + + Converte uma coluna de valores numéricos decimais em uma coluna de valores boolianos. + + + + entrada + + + + Uma coluna de valores numéricos para processar. + + + Converte um valor de escolha apoiado por um booliano em um valor booliano. + + + + opção + + + + A opção de converter em um valor booliano. + + + Converte uma coluna de valores de escolha apoiados por boolianos em uma coluna de valores boolianos. + + + + entrada + + + + Uma coluna de valores de escolha para processar. + Retorna o primeiro argumento que não está em branco diff --git a/src/strings/PowerFxResources.pt-PT.resx b/src/strings/PowerFxResources.pt-PT.resx index 90d5ab95e0..e09c92ee8d 100644 --- a/src/strings/PowerFxResources.pt-PT.resx +++ b/src/strings/PowerFxResources.pt-PT.resx @@ -581,6 +581,50 @@ Uma coluna de valores booleanos a processar. + + Converte um número decimal num valor booleano. + + + + número + + + + O valor numérico decimal a converter num valor booleano. + + + Converte uma coluna de valores numéricos decimais numa coluna de valores booleanos. + + + + entrada + + + + Uma coluna de valores numéricos a processar. + + + Converte um valor de opção suportado por um booleano num valor booleano. + + + + opção + + + + A opção a converter num valor booleano. + + + Converte uma coluna de valores de opção suportada por booleanos numa coluna de valores booleanos. + + + + entrada + + + + Uma coluna de valores de opção a processar. + Devolve o primeiro argumento que não está em branco diff --git a/src/strings/PowerFxResources.ro-RO.resx b/src/strings/PowerFxResources.ro-RO.resx index ceb21fcacc..f0b71a1c8d 100644 --- a/src/strings/PowerFxResources.ro-RO.resx +++ b/src/strings/PowerFxResources.ro-RO.resx @@ -581,6 +581,50 @@ O coloană de valori booleene de procesat. + + Convertește un număr zecimal la o valoare booleană. + + + + număr + + + + Valoarea număr zecimal de convertit la o valoare booleană. + + + Convertește o coloană de valori numerice zecimale la o coloană de valori booleene. + + + + intrare + + + + O coloană de valori numerice de procesat. + + + Convertește o valoare de opțiune bazată pe o valoare booleană într-o valoare booleană. + + + + opțiune + + + + Opțiunea de convertit la o valoare booleană. + + + Convertește o coloană de opțiuni bazate pe valori booleene la o coloană de valori booleene. + + + + intrare + + + + O coloană de valori opțiune de procesat. + Returnează primul argument nevid @@ -4231,7 +4275,7 @@ - Returnează caracterul Unicode re3ferită de valoarea numerică dată. + Returnează caracterul Unicode la care face referire valoarea numerică dată. diff --git a/src/strings/PowerFxResources.ru-RU.resx b/src/strings/PowerFxResources.ru-RU.resx index 53d080f836..b63896863b 100644 --- a/src/strings/PowerFxResources.ru-RU.resx +++ b/src/strings/PowerFxResources.ru-RU.resx @@ -581,6 +581,50 @@ Столбец логических значений для обработки. + + Преобразует десятичное число в логическое значение. + + + + число + + + + Десятичное числовое значение для преобразования в логическое значение. + + + Преобразует столбец десятичных числовых значений в столбец логических значений. + + + + входные данные + + + + Столбец числовых значений для обработки. + + + Преобразует значение варианта выбора с поддержкой логического значения в логическое значение. + + + + вариант выбора + + + + Вариант выбора для преобразования в логическое значение. + + + Преобразует столбец значений вариантов выбора с поддержкой логических значений в столбец логических значений. + + + + входные данные + + + + Столбец значений вариантов выбора для обработки. + Возвращает первый непустой аргумент diff --git a/src/strings/PowerFxResources.sk-SK.resx b/src/strings/PowerFxResources.sk-SK.resx index ed43192814..941c8c4a45 100644 --- a/src/strings/PowerFxResources.sk-SK.resx +++ b/src/strings/PowerFxResources.sk-SK.resx @@ -581,6 +581,50 @@ Stĺpec booleovských hodnôt na spracovanie. + + Konvertuje desatinné číslo na booleovskú hodnotu. + + + + číslo + + + + Desatinné číslo, ktoré sa má konvertovať na booleovskú hodnotu. + + + Konvertuje stĺpec desatinných čísel na stĺpec booleovských hodnôt. + + + + vstup + + + + Stĺpec číselných hodnôt na spracovanie. + + + Konvertuje hodnotu voľby na báze booleovskej hodnoty na booleovskú hodnotu. + + + + voľba + + + + Voľba, ktorá sa má konvertovať na booleovskú hodnotu. + + + Konvertuje stĺpec hodnôt voľby na báze booleovských hodnôt na stĺpec booleovských hodnôt. + + + + vstup + + + + Stĺpec hodnôt voľby na spracovanie. + Vráti prvý argument, ktorý nie je prázdny diff --git a/src/strings/PowerFxResources.sl-SI.resx b/src/strings/PowerFxResources.sl-SI.resx index a128978ad8..5d659269fb 100644 --- a/src/strings/PowerFxResources.sl-SI.resx +++ b/src/strings/PowerFxResources.sl-SI.resx @@ -581,6 +581,50 @@ Stolpec logičnih vrednosti, ki jih želite obdelati. + + Pretvori decimalno število v logično vrednost. + + + + število + + + + Decimalna številska vrednost za pretvorbo v logično vrednost + + + Pretvori stolpec decimalnih številskih vrednosti v stolpec logičnih vrednosti. + + + + vnos + + + + Stolpec številskih vrednosti za obdelavo. + + + Pretvori izbrano vrednost, podprto z logično vrednostjo, v logično vrednost. + + + + možnost + + + + Izbira za pretvorbo v logično vrednost. + + + Pretvori stolpec izbranih vrednosti, podprtih z logičnimi vrednostmi, v stolpec logičnih vrednosti. + + + + vnos + + + + Stolpec izbranih vrednosti za obdelavo + Vrne prvi neprazen argument diff --git a/src/strings/PowerFxResources.sr-Cyrl-RS.resx b/src/strings/PowerFxResources.sr-Cyrl-RS.resx index 6ea95689a3..3d0c33ef9b 100644 --- a/src/strings/PowerFxResources.sr-Cyrl-RS.resx +++ b/src/strings/PowerFxResources.sr-Cyrl-RS.resx @@ -581,6 +581,50 @@ Колона Булових вредности за обраду. + + Конвертује децимални број у Булову вредност. + + + + број + + + + Децимална бројчана вредност коју треба конвертовати у Булову вредност. + + + Конвертује колону децималних нумеричких вредности у колону Булових вредности. + + + + унос + + + + Колона вредности бројева за обраду. + + + Конвертује вредност избора коју подржава Булова вредност у Булову вредност. + + + + избор + + + + Избор који треба конвертовати у Булову вредност. + + + Конвертује колону вредности избора које подржавају Булове вредности у колону Булових вредности. + + + + унос + + + + Колона вредности избора за обраду. + Враћа први аргумент који није празан diff --git a/src/strings/PowerFxResources.sr-Latn-RS.resx b/src/strings/PowerFxResources.sr-Latn-RS.resx index 67cd51fa44..1e31dda333 100644 --- a/src/strings/PowerFxResources.sr-Latn-RS.resx +++ b/src/strings/PowerFxResources.sr-Latn-RS.resx @@ -581,6 +581,50 @@ Kolona Bulovih vrednosti za obradu. + + Konvertuje decimalni broj u Bulovu vrednost. + + + + broj + + + + Decimalna brojčana vrednost koju treba konvertovati u Bulovu vrednost. + + + Konvertuje kolonu decimalnih numeričkih vrednosti u kolonu Bulovih vrednosti. + + + + unos + + + + Kolona vrednosti brojeva za obradu. + + + Konvertuje vrednost izbora koju podržava Bulova vrednost u Bulovu vrednost. + + + + izbor + + + + Izbor koji treba konvertovati u Bulovu vrednost. + + + Konvertuje kolonu vrednosti izbora koje podržavaju Bulove vrednosti u kolonu Bulovih vrednosti. + + + + unos + + + + Kolona vrednosti izbora za obradu. + Vraća prvi argument koji nije prazan diff --git a/src/strings/PowerFxResources.sv-SE.resx b/src/strings/PowerFxResources.sv-SE.resx index 5d6643bc14..653c8b5df4 100644 --- a/src/strings/PowerFxResources.sv-SE.resx +++ b/src/strings/PowerFxResources.sv-SE.resx @@ -581,6 +581,50 @@ En kolumn med booleska värden att bearbeta. + + Konverterar ett decimalvärde till ett booleskt värde. + + + + tal + + + + Decimalvärdet som ska konverteras till ett booleskt värde. + + + Konverterar en kolumn med numeriska decimalvärden till en kolumn med booleska värden. + + + + indata + + + + En kolumn med numeriska värden att bearbeta. + + + Konverterar ett valvärde som stöds av en boolesk värde till ett booleskt värde. + + + + val + + + + Valet som ska konverteras till ett booleskt värde. + + + Konverterar en kolumn med valvärden som stöds av booleska till en kolumn med booleska värden. + + + + indata + + + + En kolumn med valvärden att bearbeta. + Returnerar det första icke-tomma argumentet diff --git a/src/strings/PowerFxResources.th-TH.resx b/src/strings/PowerFxResources.th-TH.resx index 6bb6cb07a4..0480880afe 100644 --- a/src/strings/PowerFxResources.th-TH.resx +++ b/src/strings/PowerFxResources.th-TH.resx @@ -581,6 +581,50 @@ คอลัมน์ของค่าแบบบูลีนที่จะประมวลผล + + แปลงตัวเลขฐานสิบเป็นค่าแบบบูลีน + + + + ตัวเลข + + + + ค่าตัวเลขฐานสิบที่จะแปลงเป็นค่าแบบบูลีน + + + แปลงคอลัมน์ของค่าตัวเลขฐานสิบเป็นคอลัมน์ของค่าแบบบูลีน + + + + ข้อมูลป้อนเข้า + + + + คอลัมน์ของค่าตัวเลขที่จะดำเนินการ + + + แปลงค่าตัวเลือกที่รองรับโดยบูลีนเป็นค่าบูลีน + + + + ชุดตัวเลือก + + + + ตัวเลือกที่จะแปลงเป็นค่าแบบบูลีน + + + แปลงคอลัมน์ของค่าตัวเลือกที่รองรับโดยบูลีนเป็นคอลัมน์ของค่าแบบบูลีน + + + + ข้อมูลป้อนเข้า + + + + คอลัมน์ของค่าตัวเลือกที่จะดำเนินการ + ส่งคืนอาร์กิวเมนต์แรกที่ไม่ได้เว้นว่าง diff --git a/src/strings/PowerFxResources.tr-TR.resx b/src/strings/PowerFxResources.tr-TR.resx index 5338cb4f19..7734dd3a66 100644 --- a/src/strings/PowerFxResources.tr-TR.resx +++ b/src/strings/PowerFxResources.tr-TR.resx @@ -581,6 +581,50 @@ İşlenecek boole değerleri sütunu. + + Bir ondalık sayısı boole değerine dönüştürür. + + + + sayı + + + + Boole değerine dönüştürülecek ondalık sayı değeri. + + + Ondalık sayısal değerler sütununu boole değerleri sütununa dönüştürür. + + + + giriş + + + + İşlenecek sayı değerlerini içeren bir sütun. + + + Boole değeriyle desteklenen bir seçim değerini boole değerine dönüştürür. + + + + seçenek + + + + Boole değerine dönüştürülecek seçim. + + + Boole değerleriyle desteklenen bir seçim değerleri sütununu boole değerleri sütununa dönüştürür. + + + + giriş + + + + İşlenecek seçim değerlerini içeren bir sütun. + Boş olmayan ilk bağımsız değişkeni döndürür diff --git a/src/strings/PowerFxResources.uk-UA.resx b/src/strings/PowerFxResources.uk-UA.resx index ebaac4773d..ba94ec0a5e 100644 --- a/src/strings/PowerFxResources.uk-UA.resx +++ b/src/strings/PowerFxResources.uk-UA.resx @@ -581,6 +581,50 @@ Стовпець логічних значень, який потрібно обробити. + + Перетворює десяткове число на логічне значення. + + + + число + + + + Десяткове числове значення, яке потрібно перетворити на логічне значення. + + + Перетворює стовпець десяткових числових значень на стовпець логічних значень. + + + + вхідні дані + + + + Стовпець числових значень, який потрібно обробити. + + + Перетворює значення вибору, яке ґрунтується на логічному значенні, на логічне значення. + + + + варіант вибору + + + + Варіант вибору, який потрібно перетворити на логічне значення. + + + Перетворює стовпець значень вибору, які ґрунтуються на логічних значеннях, на стовпець логічних значень. + + + + вхідні дані + + + + Стовпець значень вибору, який потрібно обробити. + Повертає перший непустий аргумент. diff --git a/src/strings/PowerFxResources.vi-VN.resx b/src/strings/PowerFxResources.vi-VN.resx index 90cfafc2ba..c8d01085dd 100644 --- a/src/strings/PowerFxResources.vi-VN.resx +++ b/src/strings/PowerFxResources.vi-VN.resx @@ -581,6 +581,50 @@ Cột giá trị boolean cần xử lý. + + Chuyển đổi số thập phân thành giá trị boolean. + + + + số + + + + Giá trị số thập phân cần chuyển đổi thành giá trị boolean. + + + Chuyển đổi cột giá trị số thập phân thành cột chứa giá trị boolean. + + + + đầu vào + + + + Cột giá trị số cần xử lý. + + + Chuyển đổi giá trị lựa chọn dựa trên giá trị boolean thành giá trị boolean. + + + + lựa chọn + + + + Lựa chọn cần chuyển đổi thành giá trị boolean. + + + Chuyển đổi cột giá trị lựa chọn dựa trên giá trị boolean thành cột giá trị boolean. + + + + đầu vào + + + + Cột giá trị lựa chọn cần xử lý. + Trả về đối số không trống đầu tiên diff --git a/src/strings/PowerFxResources.zh-CN.resx b/src/strings/PowerFxResources.zh-CN.resx index 4cd2737e37..97f4188325 100644 --- a/src/strings/PowerFxResources.zh-CN.resx +++ b/src/strings/PowerFxResources.zh-CN.resx @@ -581,6 +581,50 @@ 要处理的布尔值列。 + + 将十进制数转换为布尔值。 + + + + 数字 + + + + 要转换为布尔值的十进制数值。 + + + 将十进制数值列转换为布尔值列。 + + + + 输入 + + + + 要处理的数值组成的列。 + + + 将布尔值支持的选择值转换为布尔值。 + + + + 单选 + + + + 要转换为布尔值的选择。 + + + 将布尔值支持的选择值列转换为布尔值列。 + + + + 输入 + + + + 要处理的选择值列。 + 返回第一个非空白参数 diff --git a/src/strings/PowerFxResources.zh-TW.resx b/src/strings/PowerFxResources.zh-TW.resx index 694dc94541..b7c76a7cb6 100644 --- a/src/strings/PowerFxResources.zh-TW.resx +++ b/src/strings/PowerFxResources.zh-TW.resx @@ -581,6 +581,50 @@ 要處理的布林值資料行。 + + 將十進位數字轉換為布林值。 + + + + 數值 + + + + 要轉換為布林值的十進位數字值。 + + + 將十進位數值資料行轉換為布林值資料行。 + + + + 輸入 + + + + 要處理的數字值資料行。 + + + 將布林值支援的選擇值轉換為布林值。 + + + + 選擇 + + + + 要轉換為布林值的選擇。 + + + 將布林值支援的選擇值資料行轉換為布林值資料行。 + + + + 輸入 + + + + 要處理的選擇值資料行。 + 傳回第一個非空白的引數 From 7af72ad26d982fe6b99450f62020e8ab846f727b Mon Sep 17 00:00:00 2001 From: Jas Valgotar <32079188+jas-valgotar@users.noreply.github.com> Date: Wed, 6 Mar 2024 00:21:35 +0530 Subject: [PATCH 8/9] don't suggest fields that are already specified (#2240) Fixes #2126 --- .../FunctionRecordNameSuggestionHandler.cs | 9 ++++++ .../IntellisenseTests/SuggestTest.cs | 6 ++-- .../InterpreterSuggestTests.cs | 31 ++++++++++++++++--- 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/src/libraries/Microsoft.PowerFx.Core/Texl/Intellisense/SuggestionHandlers/FunctionRecordNameSuggestionHandler.cs b/src/libraries/Microsoft.PowerFx.Core/Texl/Intellisense/SuggestionHandlers/FunctionRecordNameSuggestionHandler.cs index 6460fde8d1..cb9a6d9870 100644 --- a/src/libraries/Microsoft.PowerFx.Core/Texl/Intellisense/SuggestionHandlers/FunctionRecordNameSuggestionHandler.cs +++ b/src/libraries/Microsoft.PowerFx.Core/Texl/Intellisense/SuggestionHandlers/FunctionRecordNameSuggestionHandler.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Collections.Immutable; using System.Linq; using Microsoft.PowerFx.Core.Binding.BindInfo; using Microsoft.PowerFx.Core.Functions; @@ -152,9 +153,17 @@ private static bool TryGetParentRecordFieldType(DType aggregateType, TexlNode cu internal static bool AddAggregateSuggestions(DType aggregateType, IntellisenseData.IntellisenseData intellisenseData, int cursorPos) { var suggestionsAdded = false; + var parentRecordNode = intellisenseData.CurNode.Parent as RecordNode; + var alreadyUsedFields = parentRecordNode?.Ids.Select(id => id.Name).ToImmutableHashSet() ?? Enumerable.Empty().ToImmutableHashSet(); foreach (var tName in aggregateType.GetNames(DPath.Root).Where(param => !param.Type.IsError)) { var usedName = tName.Name; + + if (alreadyUsedFields.Contains(usedName)) + { + continue; + } + if (DType.TryGetDisplayNameForColumn(aggregateType, usedName, out var maybeDisplayName)) { usedName = new DName(maybeDisplayName); diff --git a/src/tests/Microsoft.PowerFx.Core.Tests/IntellisenseTests/SuggestTest.cs b/src/tests/Microsoft.PowerFx.Core.Tests/IntellisenseTests/SuggestTest.cs index 4f3da5d03a..8bdc7f9bca 100644 --- a/src/tests/Microsoft.PowerFx.Core.Tests/IntellisenseTests/SuggestTest.cs +++ b/src/tests/Microsoft.PowerFx.Core.Tests/IntellisenseTests/SuggestTest.cs @@ -168,8 +168,8 @@ private string[] SuggestStrings(string expression, PowerFxConfig config, Culture [InlineData("[@In|]", "ErrorKind")] // FunctionRecordNameSuggestionHandler - [InlineData("Error({Kin|d:0})", "Kind:")] - [InlineData("Error({|Kind:0, Test:\"\"})", "Kind:", "Test:")] + [InlineData("Error({Kin|d:0})")] + [InlineData("Error({|Kind:0, Test:\"\"})")] // ErrorNodeSuggestionHandler [InlineData("ForAll([0],`|", "ThisRecord", "Value")] @@ -493,7 +493,7 @@ public void SuggestUser(string expression, params string[] expected) [Theory] [InlineData("{|", "output1:", "output2:")] - [InlineData("{output1: 1, |", "output1:", "output2:")] + [InlineData("{output1: 1, |", "output2:")] // We do not suggest nested type, as this can explode if type is DV. [InlineData("{output1: {|")] diff --git a/src/tests/Microsoft.PowerFx.Interpreter.Tests/InterpreterSuggestTests.cs b/src/tests/Microsoft.PowerFx.Interpreter.Tests/InterpreterSuggestTests.cs index b6fcaa702a..214da2e6bd 100644 --- a/src/tests/Microsoft.PowerFx.Interpreter.Tests/InterpreterSuggestTests.cs +++ b/src/tests/Microsoft.PowerFx.Interpreter.Tests/InterpreterSuggestTests.cs @@ -274,21 +274,42 @@ public void TestArgSuggestion(string expression, params string[] expectedSuggest "field1:")] [InlineData( "RecordInputTest( {field1 : 1}, \"test\", {|", - "id:", + "id:", + "name:")] + + // do not repeat already used fields. + [InlineData( + "RecordInputTest( {field1 : 2}, \"test\", { id: 1, |", "name:")] + + [InlineData( + "RecordInputTest( {field1 : 2}, \"test\", { name: \"test\", |", + "id:")] + [InlineData( - "RecordInputTest( {field1 : 2}, \"test\", { id: 1, name: \"test\"}, {|", + "RecordInputTest( {field1 : 2}, \"test\", { id: 1, name:\"test name\", |}")] + + [InlineData( + "RecordInputTest( {field1 : 2}, \"test\", { id: 1, name: \"test\"}, {|", "nested:", "nested2:")] // nested record field. [InlineData( - "RecordInputTest( {field1 : 3}, \"test\", { id: 1, name: \"test\"}, { nested:{|", + "RecordInputTest( {field1 : 3}, \"test\", { id: 1, name: \"test\"}, { nested:{|", "field1:")] [InlineData( - "RecordInputTest( {field1 : 4}, \"test\", { id: 1, name: \"test\"}, { nested2:{|", - "id:", + "RecordInputTest( {field1 : 4}, \"test\", { id: 1, name: \"test\"}, { nested2:{|", + "id:", "name:")] + + // do not repeat already used fields. + [InlineData( + "RecordInputTest( {field1 : 4}, \"test\", { id: 1, name: \"test\"}, { nested2:{ id: 2, |", + "name:")] + [InlineData( + "RecordInputTest( {field1 : 4}, \"test\", { id: 1, name: \"test\"}, { nested2:{ id: 2, name: \"test\", |")] + [InlineData( "RecordInputTest( {field1 : 3}, \"test\", { id: 1, name: \"test\"}, { nested:{ field1: 1}, nested2: {|", "id:", From c333d187da21340235da97c44634f84271659273 Mon Sep 17 00:00:00 2001 From: Mike Stall Date: Tue, 5 Mar 2024 16:23:13 -0800 Subject: [PATCH 9/9] add model version to fx2nl response (#2243) --- .../Protocol/CustomFx2NLParams.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libraries/Microsoft.PowerFx.LanguageServerProtocol/Protocol/CustomFx2NLParams.cs b/src/libraries/Microsoft.PowerFx.LanguageServerProtocol/Protocol/CustomFx2NLParams.cs index 08515703f3..d3de5da26e 100644 --- a/src/libraries/Microsoft.PowerFx.LanguageServerProtocol/Protocol/CustomFx2NLParams.cs +++ b/src/libraries/Microsoft.PowerFx.LanguageServerProtocol/Protocol/CustomFx2NLParams.cs @@ -32,5 +32,10 @@ public class CustomFx2NLResult /// A natural-language sentence explaining the incoming expression. /// public string Explanation { get; set; } + + /// + /// Identification (such as name/version) for model that produced the result. + /// + public string ModelId { get; set; } } }