Name Property in Flexi Layout Studio

  • Last Post 2 weeks ago
  • Topic Is Solved
Mustafa_N097 posted this 21 February 2019

In Flexi Layouts we create, Static Text element is searched using 'SearchTextFromDB' parameter. One sample argument for 'kwVendorText' field is as follows:

SearchTextFromDB: "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=User_kwVendorSpecific;Data Source=LOCALSERVER\\SQLEXPRESS", "SELECT vendorname FROM kw_1Test WHERE layout_name = 'Andis' ORDER BY ord DESC;", 10000;

In the argument above, we want to replace layout_name being referred ('Andis') to the text written in "Name" field in 'General' tab of Flexi Layout Properties (functioning similar to "layout_name = currentLayout" instead of 'layout_name = 'Andis'). The objective is to avoid replacing vendor names (i.e. 'Andis') in 'SearchTextFromDB' for each search element in new layouts, and instead allowing argument refer to whatever the current Flexi Layout Name is. This way, even though Flexi Layout name is changed, vendor names in arguments are not modified and 'SearchTextFromDB' simply searches external database according to the new Flexi Layout name.

We essentially are trying to access to Name property of a Flexi Layout and insert it into SQL query in an element's advanced pre-search relations block.

How can we achieve this? Is there a variable in Flexi Layout Studio we can insert in argument syntax? (We did not find any information in Help file, in regards to accessing Name property of Flexi Layout) Can we use Global Constants to create a constant that refers to the name of current layout?

I have also attached an image demonstrating what we would like to achieve.

Thank you in advance for your help.



Attached Files

Order By: Standard | Newest | Votes
Ekaterina posted this 2 weeks ago

Hello Mustafa,

Please try to use the Constants properties of FlexiLayout:

If you set up a constant with the name "LayoutName" this way, then you'll be able to call this constant in the code later just as LayoutName and it will be a string with the value "TestLayout". It is not fully automatical and it will require setting the constant value once when the layout is named (if you rename the layout, this constant will have to be renamed too), but it will be easy to use in the inner code of the layout.

  • Liked by
  • Mustafa_N097
Mustafa_N097 posted this 2 weeks ago

Thank you, Ekaterina. Actually, I was able to setup SQL query text as a global constants, in addition to layout name, and use it in the code.

One additional question: Is it possible to document global constants as an external file (.dll, .xml, or other) and have the Flexi Layout read the constant value from this file? (Similar to environmental variables in FC 12 Project)

I have around 15 global constants to be defined for each new layout and constants are not carried to a new Layout, when a layout alternative is imported into.

Best regards,

Ekaterina posted this 2 weeks ago

Hello Mustafa,

The Global Constants are left on the level of entire FlexiLayout and cannot be taken into an alternative.
However you can use variables hosted in an element near in the beginning of the layout and set up from an external source. These elements will be kept when your layout will become an imported alternative and you can use them in the inner layout logic.

Best regards.