Name Property in Flexi Layout Studio

  • Last Post 18 July 2019
  • 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 10 April 2019

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 10 April 2019

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 12 April 2019

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.

  • Liked by
  • Mustafa_N097
Mustafa_N097 posted this 28 April 2019

Thanks, Ekaterina.

I have one final question regarding (user-defined) variables in Flexi Layouts:

I created two static elements at the start of the layout ("lv" and "LayoutVariablesTest"). I've defined my user variables in External Fields, set their values in Adv. pre-search relations of "lv" element (all Strings). When I try to use values of those variables in subsequent element, as described in help file, they are not recognized and functions referring to them are not working as well.

I call variables as follows:

string conn = lv.dbconn;

Proper method is also described in following post (2nd entry):

What might be the issue? Why are the variables not recognized by the code in subsequent element?

I've uploaded screenshots of variables into the following online folder:

I'm trying to set all variables, expressions in a single search element at the top of the layout, and use in all subsequent elements.

Thank you in advance for your time.

Ekaterina posted this 18 July 2019


Sorry for long silence. Unfortunately, I don’t have enough time for the forum now.

The provided link is empty now.

We recommend to investigate why your scenario is not working as expected in the regional support. Please provide them the FLS project, scenario description and some samples to reproduce the issue.