TACTIC Open Source
Column accepting number values only - Printable Version

+- TACTIC Open Source (http://forum.southpawtech.com)
+-- Forum: TACTIC Open Source (http://forum.southpawtech.com/forumdisplay.php?fid=3)
+--- Forum: TACTIC Discussion (http://forum.southpawtech.com/forumdisplay.php?fid=4)
+--- Thread: Column accepting number values only (/showthread.php?tid=212)



Column accepting number values only - JimmyMcNulty - 04-16-2021

How to create a column accepting number values only?
There are columns that work this way without any adjustments.

For example:
On the sthpw/task page, there are the columns "actual_duration" and "actual_quantity".
If I create a new column, I can very easy do some calculation like this: @GET(.actual_duration) / 8 + @GET(.actual_quantity)

If I create my own columns for numbers, I can't get it to work. Even if I take the Formatted Widget, it's not working.
If I do some calculations with such a column, it is used as text.

So doing something like:
@GET(.newColumn1) + @GET(.newColumn2) - it will "just" combine two strings. This is ok, if I need this.
But I want it to be number values, so I can do something like this:
@GET(.newColumn1) + @GET(.actual_duration) - this is not working, as the first column gives a string and the second a number value.

How can I format a column to just accept number values and to use the number values for calculations?


RE: Column accepting number values only - listy - 04-18-2021

When you created a column, which type of column do you choose?
There is int or float columns, you have you tried them?


RE: Column accepting number values only - JimmyMcNulty - 04-18-2021

What do you mean by int or float columns?

I tried something like:
Display widget "Default" - Type: "Float".
Edit widget "Default".
The XML definition looks like this:

<element name="publish_1_time_work_hours" width="179px" edit="true">
<display widget="default">
<type>float</type>
</display>
</element>

and

<element name="publish_1_time_work_hours" width="179px"/>

This will be still a text column. For input and for calculations as well.

I tried several things already and maybe I can't just get it right, because some of the initial columns work right away sort of hard coded?

Initial column sthpw/task.actual_duration:
Display widget is "tactic.ui.common.SimpleTableElementWdg".
Edit widget is "Default".
This is working as number column right away.

Creating a new column with the same adjustments doesn't give the same result. It would be still a text column.

I feel really lost with this, because I don't see any reason, why this could be so difficult to achieve. What do I miss here? What would be the "normal" way of creating int or float columns?

The Tactic version is 4.4 at work, but I'm getting the same issue with my privat 4.8 Tactic.
I even tried to do this with python. Getting the variable from the column field works just fine, converting it to float is giving me an empty field. But anyway, this should work with just expression language.

Thanks in advance for any helpful advice.


RE: Column accepting number values only - listy - 04-19-2021

Ok. Let's start from the beginning.
You are creating new Search Type? Right?
Then you adding custom columnt to it? Or you just adding definition to existing Search Type?
Which search type are you trying to edit / create?
In serch type configuration there is two different things: Custom Columns, and Custom Definition
Custom Columns: allows you to create new columnt in the table, where you can choose the type aka Format of the column.
Custom Definition: allows you to create definition aka "custom view" for the columns in the tactic


RE: Column accepting number values only - JimmyMcNulty - 04-19-2021

(04-19-2021, 09:42 AM)listy Wrote: Ok. Let's start from the beginning.
You are creating new Search Type? Right?
Then you adding custom columnt to it? Or you just adding definition to existing Search Type?
Which search type are you trying to edit / create?
In serch type configuration there is two different things: Custom Columns, and Custom Definition
Custom Columns: allows you to create new columnt in the table, where you can choose the type aka Format of the column.
Custom Definition: allows you to create definition aka "custom view" for the columns in the tactic
I get the impression, I'm missing something essential.

Ok. First things first. I'm using an existing Search Type - in this case sthpw/task.
I'm adding custom columns to it, using "create new column" from the "view" menu. Or, at least I thought, I'm adding custom columns like this. For some reason, I missed the search type configuration page for creating custom columns. I'm really confused, using Tactic for some years now, but never discovering this as an issue.
What is "create new column" doing, if not creating a new custom column?

Now the question derives for me: is it possible to see sthpw/task in the search type configuration and edit the costum columns from there?