Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
andreas-hellquist-stratsys
Partner - Contributor II
Partner - Contributor II

TextAlign property handling

I am struggling with how to handle text alignment from my hypercube. On measureinfo property there is a TextAlign property but that property value is wrong. My QlikSense object is aligning "Right" and that property is "Left". I have found a workaround where I read the entire JObject and from that pick out the Representation property which in turn contains an IndicatorProps.Position property where alignment is the correct value "Right".  This is definately not how it is supposed to be done but I cant come up with any other solution. Would be forever grateful if someone has a solution for this so I can remove my custom code for fetching such a trivial design property. 

Attaching some screenshots on the data

Labels (2)
1 Solution

Accepted Solutions
alex_colombo
Employee
Employee

Hi @andreas-hellquist-stratsys , thanks for sharing the app.

I made a couple of test and this is how product works. When Text Alignment property is set to "auto", default alignments will be applies. For text values alignment is on the left, for numbers and dates is on the right. Looking at the property with GatLayout method we will see

"textAlign": {
	"auto": true,
	"align": "left"
}

This means that in this particular case, the align property is not considered by the product, because "auto" prop is set to true. Could make confusion here, but this is how it works. Align is set to true beucase is the default value. Indeed, when you switch off the auto prop in the UI you will see align left set as default. See below screenshot

alex_colombo_0-1677054429099.png

 

If I force position to right, then in properties you will see align "right"

alex_colombo_1-1677054468993.png

Then, here what we have in the GetLayout method

"textAlign": {
	"auto": false,
	"align": "right"
}

 

Finally, when auto is set to true, you will know that text are on left and dates and numbers on right. When auto is set to false, then read align value.

View solution in original post

12 Replies
alex_colombo
Employee
Employee

Hi @andreas-hellquist-stratsys , could you please share which engine api methods are you using for reading this information?
I tried to create a simple table and aligh measure values to the right. Getting the object and getting the layout I have text align property with "right" value. Below engine API methods used by me:

  1. GetObject: I'm getting my table
  2. GetLayout: I'm reading current layout for the object where I can find text align property
andreas-hellquist-stratsys
Partner - Contributor II
Partner - Contributor II
Author

Hi @alex_colombo ,

Attached screenshot is how i fetch my object. I fetch GenericObject and not Object like you if that is where I go wrong?

alex_colombo
Employee
Employee

After you fetch an generic object, use GetLayout method for reading the current layout and properties for this object

andreas-hellquist-stratsys
Partner - Contributor II
Partner - Contributor II
Author

genericObject.Layout.As<TableLayout>()

This isn't enough?

alex_colombo
Employee
Employee

It should be, I've never used it. Check the response and see if you have what you are looking for. For sure, you don't need to use GetHypercbueData method for getting measure properties

andreas-hellquist-stratsys
Partner - Contributor II
Partner - Contributor II
Author

Well, that is my question. As can be seen in my original post it shows align=left but in representation data (not exposed in objects) it shows position right.

GetHypercbueData is because I need the data as well, nothing to do with layout.

alex_colombo
Employee
Employee

Ok, so please try to change to GetLayout instead of TableLayout. If this will not fix it, it could be a bug.
Could you please attach the Qlik app? I'd like to play with APIs and your table object in order to understand if it's a bug in .NET SDK or in Engine API.

andreas-hellquist-stratsys
Partner - Contributor II
Partner - Contributor II
Author

There is unfortunately no difference when using GetLayout.

Attach the Qlik app? As an excel data export or do you want all credentials for the app? Not sure I can give you credentials, I am integrating to a client of ours.

alex_colombo
Employee
Employee

I mean if you can upload the Qlik Sense app (.qvf file)