Fetch attributes from other class

Hello, I've been trying to work this out but just can't make it work.

Is it possible to create a domain that will be able to fetch information from attributes of classX to attributes of classY?

 

example:

I have a class of "GPU"s, the class contains attributes with information about brand, model, speed, ram, etc..

Another class of "Desktop", i want to be able to input the serial number of the GPU, and have all the attribues (or the ones i chose) to show up on the "Desktop" card, that way i can know that PC1 has GPU21 and view all it's details within the same card.

1 . create new PC

2 . Input serial number of verius hardware

3 .  Fetch all desired information using the serial number from each class with a match on that serial number.

 

Is this possible?

I know i can create relations, but i want to be able to view all that information in the same card (the Desktop card)

 
You can not see the information of both classes in a single card.
In the card "Desktop" you can view the description of the model, all other information in the model are visible using the "Modify card" button in the "Relations" TAB.
If necessary, you can use a workaround: in the
Administration Module you can make no visible the "GPU"."Description" attribute, and then you can automatically set its value with a database trigger by concatenating the main information you want from the "GPU" class (eg "GPU 21 - Dell 3412 - 4GB RAM").
Or you can configure in the Administration Module a View from SQL (read only), or use a report.

 

CMDBuild Team

1 Like

Previously Tecnoteca wrote:

 
You can not see the information of both classes in a single card.
In the card "Desktop" you can view the description of the model, all other information in the model are visible using the "Modify card" button in the "Relations" TAB.
If necessary, you can use a workaround: in the
Administration Module you can make no visible the "GPU"."Description" attribute, and then you can automatically set its value with a database trigger by concatenating the main information you want from the "GPU" class (eg "GPU 21 - Dell 3412 - 4GB RAM").
Or you can configure in the Administration Module a View from SQL (read only), or use a report.

 

CMDBuild Team

 

OK I've tried to create a trigger to accomplish this but it doesn't seem to work, here's the function:
CREATE OR REPLACE FUNCTION hvi_check()
  RETURNS trigger AS
$BODY$
    BEGIN
        IF (SELECT EXISTS (SELECT "SerialNumber" FROM "DevelopmentBoards" WHERE "SerialNumber" = NEW."BoardSerial") IS TRUE) THEN
NEW."PBA" := (SELECT "PBA" FROM "DevelopmentBoards" WHERE "SerialNumber" = NEW."BoardSerial");
NEW."WO"  := (SELECT "WO"  FROM "DevelopmentBoards" WHERE "SerialNumber" = NEW."BoardSerial");
RETURN NEW;
ELSE
RAISE EXCEPTION 'Board not found';
END IF;
    END;
$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;
ALTER FUNCTION hvi_check()
  OWNER TO postgres;
 
 
I've also created a trigger for the table i want:
CREATE TRIGGER hvi_check_trg
  BEFORE INSERT OR UPDATE
  ON "Platforms"
  FOR EACH ROW
  EXECUTE PROCEDURE hvi_check();

The workaround to which we referred was to valorize GPU”.“Description” with the concatenation of the main information of that model.
In this way, the reference
attribute Desktop”.GPU” will show in the desktop card the main information of the “GPU” card (the desktop model).
Here you can find an example of how to concatenate with a trigger the surname and the name of a person on a “Employee” card, and then see both the information in the reference attribute “Computer”.“Assignee”:
http://www.cmdbuild.org/forum/forum-in-english/908224516?b_start=0#561835818
CMDBuild Team

1 Like

Hi, Can you please share it again the example of how to concatenate the attributes. The link of example in the above post doesn’t work. Thanks